Fraga
Fraga

Reputation: 1451

Asterisk, Dial plan, how can I hang after answer?

I want to hang the call just after answered.

exten => _3XXXXXXXXXX,1,Set(CALLERID(num)=1234567890)
same => n,MixMonitor(${UNIQUEID}.wav)
same => n,Dial(SIP/${EXTEN:1}@provider,,M(hang))
same => n,StopMixMonitor()
same => n,Hangup()

[macro-hang]
exten => s,1,Hangup()

any idea? I've tried a macro, but its not working.

Upvotes: 1

Views: 1713

Answers (2)

Enes Cela
Enes Cela

Reputation: 11

Use Dial's L option. This way you can adjust the length of the call. From https://www.voip-info.org/asterisk-cmd-dial : L(x[:y][:z]): Limit the call to ‘x’ ms, warning when ‘y’ ms are left, repeated every ‘z’ ms). Note: If you will make the calls to a SIP provider, they will round up the up time (if you set L(1), even if it is 1 ms it will count as 1 second). Also, they will most likely suspend your account for wangiri fraud.

Upvotes: 0

arheops
arheops

Reputation: 15259

From asterisk doc

 M(macro[^arg[^...]]): 
        macro - Name of the macro that should be executed.

        arg - Macro arguments
Execute the specified <macro> for the *called* channel before connecting to the
calling channel. Arguments can be specified to the Macro using '^' as a
delimiter. The macro can set the variable ${MACRO_RESULT} to specify the
following actions after the macro is finished executing:
        ${MACRO_RESULT}: If set, this action will be taken after the macro
        finished executing.
            ABORT: Hangup both legs of the call
            CONGESTION: Behave as if line congestion was encountered
            BUSY: Behave as if a busy signal was encountered
            CONTINUE: Hangup the called party and allow the calling party to
            continue dialplan execution at the next priority
            GOTO:[[<context>^]<exten>^]<priority>: Transfer the call to the
            specified destination.

Both ABORT and CONTINUE should do what you want.

Upvotes: 1

Related Questions