Execute dialplan on called channel

Get help with installing, upgrading and running Asterisk.

Moderators: muppetmaster, Moderator, Support

Execute dialplan on called channel

Postby sepis » Tue Aug 25, 2015 1:51 am

Hello everyone!

I want to execute some dialplan logic on callee channel regardless who initiate hangup. More than that, I need to playback some sound file to callee if calling hangup. So I use 'F' option of application Dial, like in dialplan bellow:

Code: Select all
extensions.conf
[local_call]

exten => _X.,1, Verbose(local call processing);
same  =>     n, Dial(SIP/${EXTEN},30,F(local_call,after_dial,1));
same  =>     n, Hangup();

exten => after_dial,1, Verbose(after dial);
same  =>            n, Playback(hello-world);
same  =>            n, Hangup();

exten => h,1, Verbose(hangup exten);


But in such case no code will be executed on callee channel if callee will hangup:

Code: Select all
1000 calls 8086 and 8086 hangs up.

Executing [8086@local_call:1] Verbose("SIP/1000-0000004e", "local call processing") in new stack
Executing [8086@local_call:2] Dial("SIP/1000-0000004e", "SIP/8086,30,F(local_call,after_dial,1)") in new stack
    -- Called SIP/8086
    -- SIP/8086-0000004f is ringing
    -- SIP/8086-0000004f answered SIP/1000-0000004e
    -- Locally bridging SIP/1000-0000004e and SIP/8086-0000004f
Executing [h@local_call:1] Verbose("SIP/1000-0000004e", "hangup exten") in new stack
  == Spawn extension (local_call, 8086, 2) exited non-zero on 'SIP/1000-0000004e'


Alright then, I add 'e' Dial option, as accordiing to documentation it will execute h-exten for callee.
But although documentation does not warn about using this two options in the same time, in such case 'F' option is silently ignored:

Code: Select all
In extensions.conf Dial string replaced with:
same  =>     n, Dial(SIP/${EXTEN},30,eF(local_call,after_dial,1));

1000 calls 8086 and then hangs up.

Executing [8086@local_call:1] Verbose("SIP/1000-00000050", "local call processing") in new stack
Executing [8086@local_call:2] Dial("SIP/1000-00000050", "SIP/8086,30,eF(local_call,after_dial,1)") in new stack
    -- Called SIP/8086
    -- SIP/8086-00000051 is ringing
    -- SIP/8086-00000051 answered SIP/1000-00000050
    -- Locally bridging SIP/1000-00000050 and SIP/8086-00000051
Executing [h@local_call:1] Verbose("SIP/1000-00000050", "hangup exten") in new stack
Executing [h@local_call:1] Verbose("SIP/8086-00000051", "hangup exten") in new stack
  == Spawn extension (local_call, 8086, 2) exited non-zero on 'SIP/1000-00000050'


I don't know is it a bug or expected behavior but it makes me unable to provide logic I want.
So what I want is:
1) To be able to play audio to callee if calling hangs up
2) To be able to execute some dialplan instructions on callee channel if callee hangs up. I have to execute them on callee channel for sure. So executing them on calling channel in h-exten will be insufficient.

Any suggestions?

Asterisk version:
Code: Select all
core show version
Asterisk 11.13.1~dfsg-2+b1 built by buildd @ brahms on a x86_64 running Linux on 2015-01-05 21:34:10 UTC
sepis
Newsterisk
 
Posts: 5
Joined: Mon Aug 24, 2015 11:40 pm

Return to Asterisk Support

Who is online

Users browsing this forum: No registered users and 1 guest