Re: [asterisk-users] Handling 3 different call ending causes

2008-03-20 Thread Tobias Ahlander
Date: Wed, 19 Mar 2008 11:31:57 +0200
From: Atis Lezdins [EMAIL PROTECTED]
Subject: Re: [asterisk-users] Handling 3 different call ending causes
To: Asterisk Users Mailing List - Non-Commercial Discussion
asterisk-users@lists.digium.com
Message-ID:
[EMAIL PROTECTED]
Content-Type: text/plain; charset=ISO-8859-1

On 3/17/08, Tobias Ahlander [EMAIL PROTECTED] wrote:
 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(2[: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 [EMAIL PROTECTED]:1] NoOp(SIP/1003-08a491b8, Channel
 hungup is
 SIP/1003-08a491b8) in new stack

 If I let the Sipura hang up I get:
 -- Executing [EMAIL PROTECTED]: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 [EMAIL PROTECTED]: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(1[:5000][:5000]))

exten = s,2,NoOp(Callee hangup)

 exten = h,1,NoOp(Channel hungup is ${CHANNEL})

 Have I missed something basic here or what?


This should allow you to distinguish caller and callee hangups. I suppose
dial time limit will match Callee hangup, but you can check that by
${ANSWEREDTIME} or some sort of timestamp checking before and after Dial
(altough that would include ringing time)

Regards,
Atis

--
Atis Lezdins,
VoIP Project Manager / Developer,
[EMAIL PROTECTED]
Skype: atis.lezdins
Cell Phone: +371 28806004
Cell Phone: +1 800 7300689
Work phone: +1 800 7502835



Hello List,

Ok, I solved it by using this code. This will work for me since the variable
${timeleft} is always in complete seconds. Thank you all for the ideas and
pointers :)

context hangupcause {

  s = {
Set(timeleft=7000);
Dial(SIP/1203,30,gL(${timeleft}[:4000][:4000]));
if(${timeleft} = (${ANSWEREDTIME}*1000)) {
  jump [EMAIL PROTECTED];
} else {
  jump [EMAIL PROTECTED];
}
  }

  h = {
NoOp(Caller Hangup);
  }

}

context hangupcause2 {

  s = {
NoOp(Callee Hangup);
  }

}

context notimeleft {

  s = {
NoOp(Time's up!);
  }

}
___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Handling 3 different call ending causes

2008-03-20 Thread Atis Lezdins
On 3/20/08, Tobias Ahlander [EMAIL PROTECTED] wrote:
 Date: Wed, 19 Mar 2008 11:31:57 +0200
 From: Atis Lezdins [EMAIL PROTECTED]
 Subject: Re: [asterisk-users] Handling 3 different call ending causes
  To: Asterisk Users Mailing List - Non-Commercial Discussion
 asterisk-users@lists.digium.com
 Message-ID:
 
 [EMAIL PROTECTED]
  Content-Type: text/plain; charset=ISO-8859-1
 
 On 3/17/08, Tobias Ahlander [EMAIL PROTECTED] wrote:
  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(2[: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 [EMAIL PROTECTED]:1] NoOp(SIP/1003-08a491b8, Channel
  hungup is
  SIP/1003-08a491b8) in new stack
 
  If I let the Sipura hang up I get:
   -- Executing [EMAIL PROTECTED]: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 [EMAIL PROTECTED]: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(1[:5000][:5000]))
  
 exten = s,2,NoOp(Callee hangup)
 
  exten = h,1,NoOp(Channel hungup is ${CHANNEL})
 
  Have I missed something basic here or what?
 
 
 This should allow you to distinguish caller and callee hangups. I suppose
  dial time limit will match Callee hangup, but you can check that by
 ${ANSWEREDTIME} or some sort of timestamp checking before and after Dial
 (altough that would include ringing time)
 
 Regards,
 Atis
  
 --
 Atis Lezdins,
 VoIP Project Manager / Developer,
 [EMAIL PROTECTED]
 Skype: atis.lezdins
 Cell Phone: +371 28806004
 Cell Phone: +1 800 7300689
  Work phone: +1 800 7502835



 Hello List,

 Ok, I solved it by using this code. This will work for me since the variable
 ${timeleft} is always in complete seconds. Thank you all for the ideas and
 pointers :)

 context hangupcause {

   s = {
 Set(timeleft=7000);
 Dial(SIP/1203,30,gL(${timeleft}[:4000][:4000]));
 if(${timeleft} = (${ANSWEREDTIME}*1000)) {
   jump [EMAIL PROTECTED];
 } else {
jump [EMAIL PROTECTED];
 }
   }

   h = {
 NoOp(Caller Hangup);
   }

 }

 context hangupcause2 {

   s = {
 NoOp(Callee Hangup);
   }

 }

 context notimeleft {

   s = {
 NoOp(Time's up!);
   }

 }



I would change that to = just for reliability - you never know :)

Regards,
Atis

-- 
Atis Lezdins,
VoIP Project Manager / Developer,
[EMAIL PROTECTED]
Skype: atis.lezdins
Cell Phone: +371 28806004
Cell Phone: +1 800 7300689
Work phone: +1 800 7502835

___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Handling 3 different call ending causes

2008-03-19 Thread Tobias Ahlander
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(2[: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 still haven't gotten this to work... I'm thinking that perhaps this could
be solve with a macro? I haven't worked much with macros tho, anyone of you
think it might be possible?

Thanks,
Best regards,
Tobias
___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Handling 3 different call ending causes

2008-03-19 Thread Atis Lezdins
On 3/17/08, Tobias Ahlander [EMAIL PROTECTED] wrote:
 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(2[: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 [EMAIL PROTECTED]:1] NoOp(SIP/1003-08a491b8, Channel hungup 
 is
 SIP/1003-08a491b8) in new stack

 If I let the Sipura hang up I get:
 -- Executing [EMAIL PROTECTED]: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 [EMAIL PROTECTED]: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(1[:5000][:5000]))

exten = s,2,NoOp(Callee hangup)

 exten = h,1,NoOp(Channel hungup is ${CHANNEL})

 Have I missed something basic here or what?


This should allow you to distinguish caller and callee hangups. I
suppose dial time limit will match Callee hangup, but you can check
that by ${ANSWEREDTIME} or some sort of timestamp checking before and
after Dial (altough that would include ringing time)

Regards,
Atis

-- 
Atis Lezdins,
VoIP Project Manager / Developer,
[EMAIL PROTECTED]
Skype: atis.lezdins
Cell Phone: +371 28806004
Cell Phone: +1 800 7300689
Work phone: +1 800 7502835

___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Handling 3 different call ending causes

2008-03-19 Thread Tobias Ahlander
Date: Wed, 19 Mar 2008 11:31:57 +0200
From: Atis Lezdins [EMAIL PROTECTED]
Subject: Re: [asterisk-users] Handling 3 different call ending causes
To: Asterisk Users Mailing List - Non-Commercial Discussion
asterisk-users@lists.digium.com
Message-ID:
[EMAIL PROTECTED]
Content-Type: text/plain; charset=ISO-8859-1

On 3/17/08, Tobias Ahlander [EMAIL PROTECTED] wrote:
 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(2[: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 [EMAIL PROTECTED]:1] NoOp(SIP/1003-08a491b8, Channel
 hungup is
 SIP/1003-08a491b8) in new stack

 If I let the Sipura hang up I get:
 -- Executing [EMAIL PROTECTED]: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 [EMAIL PROTECTED]: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(1[:5000][:5000]))

exten = s,2,NoOp(Callee hangup)

 exten = h,1,NoOp(Channel hungup is ${CHANNEL})

 Have I missed something basic here or what?


This should allow you to distinguish caller and callee hangups. I suppose
dial time limit will match Callee hangup, but you can check that by
${ANSWEREDTIME} or some sort of timestamp checking before and after Dial
(altough that would include ringing time)

Regards,
Atis

--
Atis Lezdins,
VoIP Project Manager / Developer,
[EMAIL PROTECTED]
Skype: atis.lezdins
Cell Phone: +371 28806004
Cell Phone: +1 800 7300689
Work phone: +1 800 7502835

Atis,

It's always the simplest answers that are the best, this seems to work
indeed (thinking about putting a goto instead of NoOp). Will try this out
during the day tomorrow and I will let you guys know the results :)

Thank you very much,
Best regards,
Tobias
___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

[asterisk-users] Handling 3 different call ending causes

2008-03-17 Thread Tobias Ahlander
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(2[: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?

Thanks,
Best regards,
Tobias
___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Handling 3 different call ending causes

2008-03-17 Thread Alex Balashov
Tobias Ahlander 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(2[: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.

-- 
Alex Balashov
Evariste Systems
Web: http://www.evaristesys.com/
Tel: (+1) (678) 954-0670
Direct : (+1) (678) 954-0671
Mobile : (+1) (706) 338-8599

___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Handling 3 different call ending causes

2008-03-17 Thread Tobias Ahlander
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(2[: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 [EMAIL PROTECTED]:1] NoOp(SIP/1003-08a491b8, Channel hungup is
SIP/1003-08a491b8) in new stack

If I let the Sipura hang up I get:
-- Executing [EMAIL PROTECTED]: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 [EMAIL PROTECTED]: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(1[:5000][:5000]))
exten = h,1,NoOp(Channel hungup is ${CHANNEL})

Have I missed something basic here or what?

Thanks again,
Best regards,
Tobias
___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Handling 3 different call ending causes

2008-03-17 Thread Arjan Kroon | Mobillion
http://www.voip-info.org/tiki-index.php?page=Asterisk+variable+hangupcau
se

 

 



From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Tobias
Ahlander
Sent: maandag 17 maart 2008 15:35
To: asterisk-users@lists.digium.com
Subject: Re: [asterisk-users] Handling 3 different call ending causes

 

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(2[: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 [EMAIL PROTECTED]:1] NoOp(SIP/1003-08a491b8, Channel hungup
is SIP/1003-08a491b8) in new stack

If I let the Sipura hang up I get:
-- Executing [EMAIL PROTECTED]: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 [EMAIL PROTECTED]: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(1[:5000][:5000]))
exten = h,1,NoOp(Channel hungup is ${CHANNEL})

Have I missed something basic here or what? 

Thanks again, 
Best regards, 
Tobias

___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Handling 3 different call ending causes

2008-03-17 Thread Tobias Ahlander
Hello,

Tried that too, but it reports cause 16 in all 3 cases, which means normal
clearing.

Thanks,
Best regards,
Tobias

Date: Mon, 17 Mar 2008 15:54:47 +0100
From: Arjan Kroon | Mobillion [EMAIL PROTECTED]
Subject: Re: [asterisk-users] Handling 3 different call ending causes
To: Asterisk Users Mailing List - Non-Commercial Discussion
asterisk-users@lists.digium.com
Message-ID:

[EMAIL PROTECTED]

Content-Type: text/plain; charset=us-ascii

http://www.voip-info.org/tiki-index.php?page=Asterisk+variable+hangupcau
se







From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Tobias
Ahlander
Sent: maandag 17 maart 2008 15:35
To: asterisk-users@lists.digium.com
Subject: Re: [asterisk-users] Handling 3 different call ending causes



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(2[: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 [EMAIL PROTECTED]:1] NoOp(SIP/1003-08a491b8, Channel hungup is
SIP/1003-08a491b8) in new stack

If I let the Sipura hang up I get:
-- Executing [EMAIL PROTECTED]: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 [EMAIL PROTECTED]: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(1[:5000][:5000]))
exten = h,1,NoOp(Channel hungup is ${CHANNEL})

Have I missed something basic here or what?

Thanks again,
Best regards,
Tobias
___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users