[asterisk-users] Handling 3 different call ending causes

Tobias Ahlander plyschen at gmail.com
Mon Mar 17 09:35:05 CDT 2008


Alex Balashov wrote:
>> Hello List,
>>
>> I'm using a dialstring like the one below. I want to have three
>> different things happening depending on exit cause.
>>
>> Dial(SIP/${phonenumber},20,gL(20000[:5000][:5000]))
>>
>> These 3 things could happen:
>> 1, Caller hangs up
>> 2, Callee hangs up
>> 3, The 20 seconds is up and call is terminated from Asterisk.
>>
>> Is there a way to separate these 3?
>
>You can handle the 'h' extension in the dial plan, which will supply the
${CHANNEL} that was hung up, and possibly some additional dial plan
variables as well:
>
>http://www.voip-info.org/wiki/index.php?page=Asterisk+h+extension
>
>Using these, you can piece together who hung up on whom, etc.
>
>#2 is handled by fallthrough in the dial plan that causes the instructions
to continue executing to the next priority for that extension, whereas if
the call completes (Dial() is successfully connected), this does not happen.

I''ve tried to use the h extension in combination with the ${CHANNEL} in the
dialplan as suggested on the wiki page, but I haven't had any luck with it.

For this test I have a Sipura phone with number 1003 and a X-lite with 1203.
If I let the time go by (the 20 seconds defined in the Dial Command) I get
the following:
-- Executing [h at hangupcause:1] NoOp("SIP/1003-08a491b8", "Channel hungup is
SIP/1003-08a491b8") in new stack

If I let the Sipura hang up I get:
-- Executing [h at hangupcause:1] NoOp("SIP/1003-08a491b8", "Channel hungup is
SIP/1003-08a491b8") in new stack

Lastly if I let the X-lite hang up I get:
-- Executing [h at hangupcause:1] NoOp("SIP/1003-08a491b8", "Channel hungup is
SIP/1003-08a491b8") in new stack

Yes they are all the same :(

Perhaps there's something wrong with my code? Its just a small context with
the following for this test:
[hangupcause]
exten => s,1,Dial(SIP/1203,30,gL(10000[:5000][:5000]))
exten => h,1,NoOp(Channel hungup is ${CHANNEL})

Have I missed something basic here or what?

Thanks again,
Best regards,
Tobias
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20080317/5eb245b9/attachment.htm 


More information about the asterisk-users mailing list