Hi, Try as I might, I can't get hangups detected on a Zap channel with loop start lines. So, after someone leaves a voicemail and then hangs up, Asterisk doesn't know it, exits VoicemailMain2, and loops back to the corporate greeting, tying up the line even though the outside caller has hung up. Therefore, I've added the following hideous hack - er, code - to voicemail2.c. It starts right after the call to play_and_record() in leave_voicemail(). if (res != '#' && chan != NULL && !strncmp(chan->name, "Zap", 3)) { /* Hang up the Zap channel only */ ast_softhangup(chan, AST_SOFTHANGUP_EXPLICIT); } Obviously, it hangs up the channel after the voicemail has been recorded, if the # key wasn't pressed, if the channel still exists, and if it's a Zap channel. I couldn't see a way to do this with AGI. Question: is this safe? I used a soft hangup because the channel is controlled by another thread. I also modified channel.c so that ast_channel_free() sets chan to NULL after it's freed, just in case. Is there anything else I should be aware of? The code seems to work in my testing, resulting in a proper hangup right after the voicemail has been recorded. I'm not up on my Asterisk internals, so I'm not totally confident about this. Thanks, Chris
Have you tried using kewlstart instead? Your loopstart lines might be configured for kewlstart (forward disconnect supervision). -wade> -----Original Message----- > From: Christian Hecimovic [mailto:checimovic@qworks.ca] > Sent: Tuesday, September 16, 2003 7:48 PM > To: asterisk-users@lists.digium.com > Subject: [Asterisk-Users] Hangups after voicemail > > Hi, > > Try as I might, I can't get hangups detected on a Zap channel withloop> start > lines. So, after someone leaves a voicemail and then hangs up,Asterisk> doesn't know it, exits VoicemailMain2, and loops back to the corporate > greeting, tying up the line even though the outside caller has hungup.> > Therefore, I've added the following hideous hack - er, code - to > voicemail2.c. > It starts right after the call to play_and_record() inleave_voicemail().> > if (res != '#' && chan != NULL && !strncmp(chan->name, "Zap", 3)) { > /* Hang up the Zap channel only */ > ast_softhangup(chan, AST_SOFTHANGUP_EXPLICIT); > } > > Obviously, it hangs up the channel after the voicemail has beenrecorded,> if > the # key wasn't pressed, if the channel still exists, and if it's aZap> channel. I couldn't see a way to do this with AGI. > > Question: is this safe? I used a soft hangup because the channel is > controlled > by another thread. I also modified channel.c so thatast_channel_free()> sets > chan to NULL after it's freed, just in case. Is there anything else I > should > be aware of? The code seems to work in my testing, resulting in aproper> hangup right after the voicemail has been recorded. I'm not up on my > Asterisk > internals, so I'm not totally confident about this. > > Thanks, > > Chris > > > _______________________________________________ > Asterisk-Users mailing list > Asterisk-Users@lists.digium.com > http://lists.digium.com/mailman/listinfo/asterisk-users
> Have you tried using kewlstart instead? Your loopstart > lines might be configured for kewlstart (forward > disconnect supervision).I found there to be quite a delay there, around 20 seconds between the calling party clearing down and the telco giving me loop current drop. Is that something you could ask the telco to change? In the UK you get the loop current drop immediately, followed by "Do-dah-dit The other person has cleared.." announcement. Paul
Do you have silence in the channel when the remote user hangs up or busy tone ? If you have silence you can use maxsilence=x_seconds in voicemail.conf with Voicemail2 application and that will make sure the calls are hanged up after x_seconds of silence in the channel. If you have busy tone then use the busydetect=yes in zapata.conf. You can also limit the length of the voicemail message with maxmessage=x_seconds in the voicemail.conf regards Martin On Tue, 16 Sep 2003, Christian Hecimovic wrote:> Hi, > > Try as I might, I can't get hangups detected on a Zap channel with loop start > lines. So, after someone leaves a voicemail and then hangs up, Asterisk > doesn't know it, exits VoicemailMain2, and loops back to the corporate > greeting, tying up the line even though the outside caller has hung up. > > Therefore, I've added the following hideous hack - er, code - to voicemail2.c. > It starts right after the call to play_and_record() in leave_voicemail(). > > if (res != '#' && chan != NULL && !strncmp(chan->name, "Zap", 3)) { > /* Hang up the Zap channel only */ > ast_softhangup(chan, AST_SOFTHANGUP_EXPLICIT); > } > > Obviously, it hangs up the channel after the voicemail has been recorded, if > the # key wasn't pressed, if the channel still exists, and if it's a Zap > channel. I couldn't see a way to do this with AGI. > > Question: is this safe? I used a soft hangup because the channel is controlled > by another thread. I also modified channel.c so that ast_channel_free() sets > chan to NULL after it's freed, just in case. Is there anything else I should > be aware of? The code seems to work in my testing, resulting in a proper > hangup right after the voicemail has been recorded. I'm not up on my Asterisk > internals, so I'm not totally confident about this. > > Thanks, > > Chris > > > _______________________________________________ > Asterisk-Users mailing list > Asterisk-Users@lists.digium.com > http://lists.digium.com/mailman/listinfo/asterisk-users >
Silencethreshold of 256 sounds a bit high... You can also add a timeout extension to just hangup the line: exten => t,1,Hangup Without using Kewlstart, there isn't anyway for Asterisk to know that the line has been disconnected, so you'll have to use the timeouts. -wade> -----Original Message----- > From: Christian Hecimovic [mailto:checimovic@qworks.ca] > Sent: Wednesday, September 17, 2003 11:59 AM > To: asterisk-users@lists.digium.com > Subject: Re: [Asterisk-Users] Hangups after voicemail > > Hi Martin, > > Yes, silence detection in voicemail is working. I am using Voicemail2with> the > silencethreshold set to 256. However, the line doesn't hang up afterthe> silence is detected; instead, Voicemail2 exits after recording the > voicemail > correctly, and Asterisk loops back into the main menu as if the # keywas> pressed because the channel is still alive. Then it times out after 15 > seconds, as you can see below. > > From extensions.conf: > > [incoming] > exten => s,1,Answer > exten => s,2,DigitTimeout,5 > exten => s,3,ResponseTimeout,10 > exten => s,4,BackGround(corp_greeting) > include => locals > include => errors > > The locals context consists of macros which look like this: > > exten => s,1,Playback(transfer,skip) > exten => s,2,Dial(${ARG2},20) > exten => s,3,Voicemail2(u${ARG1}) > exten => s,4,Goto(incoming,s,1) > exten => s,103,Voicemail2(b${ARG1}) > exten => s,104,Goto(incoming,s,1) > > So after a voicemail is left, there is a Goto back into the incoming > context. > It all works great, except for when the line gets tied up by the > DigitTimeout > and ResponseTimeout bits when hangups aren't detected. > > I've tried using BUSYDETECT_MARTIN with busydetect=yes and it didn'twork.> The > channel stays up after the outside caller hangs up. > > Since all of our inside phones are SIP lines, there is no problem > detecting > hangups when a voice conversation is taking place, since Asterisk > obviously > detects SIP hangups correctly whether it's SIP to SIP or SIP tooutside> line. > The problem is really only when outside callers leave voicemail. > > Thanks, > > Chris > > On Wednesday 17 September 2003 08:09, Martin Pycko wrote: > > Do you have silence in the channel when the remote user hangs up orbusy> > tone ? > > > > If you have silence you can use maxsilence=x_seconds invoicemail.conf> > with > > Voicemail2 application and that will make sure the calls are hangedup> > after x_seconds of silence in the channel. > > > > If you have busy tone then use the busydetect=yes in zapata.conf. > > You can also limit the length of the voicemail message with > > maxmessage=x_seconds in the voicemail.conf > > > > regards > > Martin > > > > On Tue, 16 Sep 2003, Christian Hecimovic wrote: > > > Hi, > > > > > > Try as I might, I can't get hangups detected on a Zap channel with > loop > > > start lines. So, after someone leaves a voicemail and then hangsup,> > > Asterisk doesn't know it, exits VoicemailMain2, and loops back tothe> > > corporate greeting, tying up the line even though the outsidecaller> has > > > hung up. > > > > > > Therefore, I've added the following hideous hack - er, code - to > > > voicemail2.c. It starts right after the call to play_and_record()in> > > leave_voicemail(). > > > > > > if (res != '#' && chan != NULL && !strncmp(chan->name, "Zap", 3)){> > > /* Hang up the Zap channel only */ > > > ast_softhangup(chan, AST_SOFTHANGUP_EXPLICIT); > > > } > > > > > > Obviously, it hangs up the channel after the voicemail has been > recorded, > > > if the # key wasn't pressed, if the channel still exists, and ifit's> a > > > Zap channel. I couldn't see a way to do this with AGI. > > > > > > Question: is this safe? I used a soft hangup because the channelis> > > controlled by another thread. I also modified channel.c so that > > > ast_channel_free() sets chan to NULL after it's freed, just incase.> Is > > > there anything else I should be aware of? The code seems to workin my> > > testing, resulting in a proper hangup right after the voicemailhas> been > > > recorded. I'm not up on my Asterisk internals, so I'm not totally > > > confident about this. > > > > > > Thanks, > > > > > > Chris > > > > > > > > > _______________________________________________ > > > Asterisk-Users mailing list > > > Asterisk-Users@lists.digium.com > > > http://lists.digium.com/mailman/listinfo/asterisk-users > > > > _______________________________________________ > > Asterisk-Users mailing list > > Asterisk-Users@lists.digium.com > > http://lists.digium.com/mailman/listinfo/asterisk-users > > _______________________________________________ > Asterisk-Users mailing list > Asterisk-Users@lists.digium.com > http://lists.digium.com/mailman/listinfo/asterisk-users
Then it sounds like your Telco isn't giving you kewlstart signaling. This is by far the most reliable method of telling asterisk that the line has been disconnected. Trying asking your Telco if they can supply you with Kewlstart or Forward Disconnect Supervision on your line. Basically, all this does is momentarily reverse the polarity on the line to indicate that the line has been disconnected. The Zaptel FXO devices detect this condition to indicate to Asterisk that the line has been disconnected. -wade> -----Original Message----- > From: Christian Hecimovic [mailto:checimovic@qworks.ca] > Sent: Wednesday, September 17, 2003 12:01 PM > To: asterisk-users@lists.digium.com > Subject: Re: [Asterisk-Users] Hangups after voicemail > > Hi Wade, > > Yes, my zapata.conf looks like this: > > group = 1 > context = incoming > signalling = fxs_ks > echocancel = yes > echocancelwhenbridged = yes > channel => 1-2 > > So they are configured as kewlstart. > > Thanks, > > Chris > > On Tuesday 16 September 2003 16:53, Wade J. Weppler wrote: > > Have you tried using kewlstart instead? Your loopstart lines mightbe> > configured for kewlstart (forward disconnect supervision). > > > > -wade > > > > > -----Original Message----- > > > From: Christian Hecimovic [mailto:checimovic@qworks.ca] > > > Sent: Tuesday, September 16, 2003 7:48 PM > > > To: asterisk-users@lists.digium.com > > > Subject: [Asterisk-Users] Hangups after voicemail > > > > > > Hi, > > > > > > Try as I might, I can't get hangups detected on a Zap channel with > > > > loop > > > > > start > > > lines. So, after someone leaves a voicemail and then hangs up, > > > > Asterisk > > > > > doesn't know it, exits VoicemailMain2, and loops back to thecorporate> > > greeting, tying up the line even though the outside caller hashung> > > > up. > > > > > Therefore, I've added the following hideous hack - er, code - to > > > voicemail2.c. > > > It starts right after the call to play_and_record() in > > > > leave_voicemail(). > > > > > if (res != '#' && chan != NULL && !strncmp(chan->name, "Zap", 3)){> > > /* Hang up the Zap channel only */ > > > ast_softhangup(chan, AST_SOFTHANGUP_EXPLICIT); > > > } > > > > > > Obviously, it hangs up the channel after the voicemail has been > > > > recorded, > > > > > if > > > the # key wasn't pressed, if the channel still exists, and if it'sa> > > > Zap > > > > > channel. I couldn't see a way to do this with AGI. > > > > > > Question: is this safe? I used a soft hangup because the channelis> > > controlled > > > by another thread. I also modified channel.c so that > > > > ast_channel_free() > > > > > sets > > > chan to NULL after it's freed, just in case. Is there anythingelse I> > > should > > > be aware of? The code seems to work in my testing, resulting in a > > > > proper > > > > > hangup right after the voicemail has been recorded. I'm not up onmy> > > Asterisk > > > internals, so I'm not totally confident about this. > > > > > > Thanks, > > > > > > Chris > > > > > > > > > _______________________________________________ > > > Asterisk-Users mailing list > > > Asterisk-Users@lists.digium.com > > > http://lists.digium.com/mailman/listinfo/asterisk-users > > > > _______________________________________________ > > Asterisk-Users mailing list > > Asterisk-Users@lists.digium.com > > http://lists.digium.com/mailman/listinfo/asterisk-users > > _______________________________________________ > Asterisk-Users mailing list > Asterisk-Users@lists.digium.com > http://lists.digium.com/mailman/listinfo/asterisk-users
Gerry Boudreaux
2003-Sep-17 09:26 UTC
[Asterisk-Users] Configuration for Asterisk with Cisco Router FXO
Since I see so many questions about this, and could not find a concise answer when I was looking for the same thing... Here is an example showing how to configure communications between Asterisk and a Cisco 2600 router with an FXO card in it. http://www.tape.net/~gerry/asterisk/cisco26x0.html Comments and suggestions are welcome.
You can still use timeouts. The responsetimeout would only be active in the main menu. If they don't respond within the timeout, then hangup on them. The alternative is to loop the menu a set number of times before hanging up. This would require some logic. -wade> -----Original Message----- > From: Christian Hecimovic [mailto:checimovic@qworks.ca] > Sent: Wednesday, September 17, 2003 12:41 PM > To: asterisk-users@lists.digium.com > Subject: Re: [Asterisk-Users] Hangups after voicemail > > Yes, I had to set it high, otherwise it didn't work right...I'llfiddle> with > it a bit. > > Timeouts aren't really an option, because if the caller presses #after> leaving a voicemail then they should be popped back into the mainmenu. If> I > could check DTMF signals from extensions.conf, then this would indeed > work. > Basically, the logic after Voicemail2 exits should be > > if (last key was not # and the channel is still alive) > hangup > else > goto the main menu > > The only way I could do this was by modifying voicemail2.c. So, backto my> main question: are there any problems with this? I'm most concernedabout> memory issues. Should I be freeing something first, making anothercleanup> function call, etc.? > > On Wednesday 17 September 2003 09:08, Wade J. Weppler wrote: > > Silencethreshold of 256 sounds a bit high... > > > > You can also add a timeout extension to just hangup the line: > > > > exten => t,1,Hangup > > > > Without using Kewlstart, there isn't anyway for Asterisk to knowthat> > the line has been disconnected, so you'll have to use the timeouts. > > > > -wade > > > > > -----Original Message----- > > > From: Christian Hecimovic [mailto:checimovic@qworks.ca] > > > Sent: Wednesday, September 17, 2003 11:59 AM > > > To: asterisk-users@lists.digium.com > > > Subject: Re: [Asterisk-Users] Hangups after voicemail > > > > > > Hi Martin, > > > > > > Yes, silence detection in voicemail is working. I am usingVoicemail2> > > > with > > > > > the > > > silencethreshold set to 256. However, the line doesn't hang upafter> > > > the > > > > > silence is detected; instead, Voicemail2 exits after recording the > > > voicemail > > > correctly, and Asterisk loops back into the main menu as if the #key> > > > was > > > > > pressed because the channel is still alive. Then it times outafter 15> > > seconds, as you can see below. > > > > > > From extensions.conf: > > > > > > [incoming] > > > exten => s,1,Answer > > > exten => s,2,DigitTimeout,5 > > > exten => s,3,ResponseTimeout,10 > > > exten => s,4,BackGround(corp_greeting) > > > include => locals > > > include => errors > > > > > > The locals context consists of macros which look like this: > > > > > > exten => s,1,Playback(transfer,skip) > > > exten => s,2,Dial(${ARG2},20) > > > exten => s,3,Voicemail2(u${ARG1}) > > > exten => s,4,Goto(incoming,s,1) > > > exten => s,103,Voicemail2(b${ARG1}) > > > exten => s,104,Goto(incoming,s,1) > > > > > > So after a voicemail is left, there is a Goto back into theincoming> > > context. > > > It all works great, except for when the line gets tied up by the > > > DigitTimeout > > > and ResponseTimeout bits when hangups aren't detected. > > > > > > I've tried using BUSYDETECT_MARTIN with busydetect=yes and itdidn't> > > > work. > > > > > The > > > channel stays up after the outside caller hangs up. > > > > > > Since all of our inside phones are SIP lines, there is no problem > > > detecting > > > hangups when a voice conversation is taking place, since Asterisk > > > obviously > > > detects SIP hangups correctly whether it's SIP to SIP or SIP to > > > > outside > > > > > line. > > > The problem is really only when outside callers leave voicemail. > > > > > > Thanks, > > > > > > Chris > > > > > > On Wednesday 17 September 2003 08:09, Martin Pycko wrote: > > > > Do you have silence in the channel when the remote user hangs upor> > > > busy > > > > > > tone ? > > > > > > > > If you have silence you can use maxsilence=x_seconds in > > > > voicemail.conf > > > > > > with > > > > Voicemail2 application and that will make sure the calls arehanged> > > > up > > > > > > after x_seconds of silence in the channel. > > > > > > > > If you have busy tone then use the busydetect=yes inzapata.conf.> > > > You can also limit the length of the voicemail message with > > > > maxmessage=x_seconds in the voicemail.conf > > > > > > > > regards > > > > Martin > > > > > > > > On Tue, 16 Sep 2003, Christian Hecimovic wrote: > > > > > Hi, > > > > > > > > > > Try as I might, I can't get hangups detected on a Zap channelwith> > > > > > loop > > > > > > > > start lines. So, after someone leaves a voicemail and thenhangs> > > > up, > > > > > > > Asterisk doesn't know it, exits VoicemailMain2, and loops backto> > > > the > > > > > > > corporate greeting, tying up the line even though the outside > > > > caller > > > > > has > > > > > > > > hung up. > > > > > > > > > > Therefore, I've added the following hideous hack - er, code -to> > > > > voicemail2.c. It starts right after the call toplay_and_record()> > > > in > > > > > > > leave_voicemail(). > > > > > > > > > > if (res != '#' && chan != NULL && !strncmp(chan->name, "Zap",3))> > > > { > > > > > > > /* Hang up the Zap channel only */ > > > > > ast_softhangup(chan, AST_SOFTHANGUP_EXPLICIT); > > > > > } > > > > > > > > > > Obviously, it hangs up the channel after the voicemail hasbeen> > > > > > recorded, > > > > > > > > if the # key wasn't pressed, if the channel still exists, andif> > > > it's > > > > > a > > > > > > > > Zap channel. I couldn't see a way to do this with AGI. > > > > > > > > > > Question: is this safe? I used a soft hangup because thechannel> > > > is > > > > > > > controlled by another thread. I also modified channel.c sothat> > > > > ast_channel_free() sets chan to NULL after it's freed, just in > > > > case. > > > > > Is > > > > > > > > there anything else I should be aware of? The code seems towork> > > > in my > > > > > > > testing, resulting in a proper hangup right after thevoicemail> > > > has > > > > > been > > > > > > > > recorded. I'm not up on my Asterisk internals, so I'm nottotally> > > > > confident about this. > > > > > > > > > > Thanks, > > > > > > > > > > Chris > > > > > > > > > > > > > > > _______________________________________________ > > > > > Asterisk-Users mailing list > > > > > Asterisk-Users@lists.digium.com > > > > > http://lists.digium.com/mailman/listinfo/asterisk-users > > > > > > > > _______________________________________________ > > > > Asterisk-Users mailing list > > > > Asterisk-Users@lists.digium.com > > > > http://lists.digium.com/mailman/listinfo/asterisk-users > > > > > > _______________________________________________ > > > Asterisk-Users mailing list > > > Asterisk-Users@lists.digium.com > > > http://lists.digium.com/mailman/listinfo/asterisk-users > > > > _______________________________________________ > > Asterisk-Users mailing list > > Asterisk-Users@lists.digium.com > > http://lists.digium.com/mailman/listinfo/asterisk-users > > _______________________________________________ > Asterisk-Users mailing list > Asterisk-Users@lists.digium.com > http://lists.digium.com/mailman/listinfo/asterisk-users
Gerry Boudreaux
2003-Sep-17 10:36 UTC
[Asterisk-Users] Configuration for Asterisk with Cisco Router FXO
At 11:55 AM 9/17/2003, Doug Heckaman III <tad@heckaman.com> wrote:>I have a Cisco 2600 with a T1 CSU/DSU. Would that work the same way? I >would really like to see if I can use the cisco csu/dsu rather than buying >a 500 dollar T1 card...The cards serve a completely different function. The FXO card only handles POTS, and the WIC-1DSU-T1 is not a PRI interface... I have no access to either of the VWIC Multiflex trunk cards, or the NM-xCT1-CSU cards so therefore I have no clue if they would work. (Not sure which one you are talking about) Sorry