Adams, Gavin
2003-Oct-24 11:23 UTC
[Asterisk-Users] How to use the Cut() command to chop off an ending character
I used to be able to pass dial strings to IAX2 providers with # characters at the end of the string. This is how we end dial strings for international calls. So, I would like to be able to selectivity chop off any # characters at the end of string, only if they exist. Basically as follows (chopping off the leading '9' with ${EXTEN:1} syntax: EXTEN from Phone EXTEN for Dial String 9011445551212# 011445551212 9011445551212 011445551212 StripLSD isn't helpful in the second case, but potentially Cut could do it. I can't, for the life of me, figure out the syntax for Cut to do this. Understood that I need to set a new variable with the result of Cut and use this as the dial string. Any optimal way to chop off the errant # (and maybe the leading 9 at the same time)???? Regards, --- Gavin Adams Promisant (Technology) Ltd. Atlanta, GA
Andrew Joakimsen
2003-Oct-24 12:11 UTC
[Asterisk-Users] How to use the Cut() command to chop off an ending character
I don't see what the problem is, Asterisk will see them as two separate extensions Exten => _9011xxxxxxxxx#,1,StripLSD(1) (or _9011.# if there is not a fixed number of digits, change the other xxxxxxx to be .) Exten => _9011xxxxxxxxx,2,Dial(IAX2/${exten:1}@..... (or exten:4 if you do not need to send off the 011) And then have another one for when you don't press # Exten => _9011xxxxxxxxxx,1,Dial(IAX2/${exten:1}@..... Regards,> -----Original Message----- > From: asterisk-users-admin@lists.digium.com [mailto:asterisk-users- > admin@lists.digium.com] On Behalf Of Adams, Gavin > Sent: Friday, October 24, 2003 2:24 PM > To: asterisk-users@lists.digium.com > Subject: [Asterisk-Users] How to use the Cut() command to chop off an > ending character > > pamAssassin 2.55 (1.174.2.19-2003-05-19-exp) > > I used to be able to pass dial strings to IAX2 providers with # > characters at the end of the string. This is how we end dial stringsfor> international calls. > > So, I would like to be able to selectivity chop off any # charactersat> the end of string, only if they exist. Basically as follows (chopping > off the leading '9' with ${EXTEN:1} syntax: > > EXTEN from Phone EXTEN for Dial String > > 9011445551212# 011445551212 > 9011445551212 011445551212 > > StripLSD isn't helpful in the second case, but potentially Cut coulddo> it. I can't, for the life of me, figure out the syntax for Cut to do > this. Understood that I need to set a new variable with the result of > Cut and use this as the dial string. > > Any optimal way to chop off the errant # (and maybe the leading 9 atthe> same time)???? > > Regards, > > --- Gavin Adams > Promisant (Technology) Ltd. > Atlanta, GA > > _______________________________________________ > Asterisk-Users mailing list > Asterisk-Users@lists.digium.com > http://lists.digium.com/mailman/listinfo/asterisk-users
Adams, Gavin
2003-Oct-24 13:29 UTC
[Asterisk-Users] How to use the Cut() command to chop off an ending character
> -----Original Message----- > From: Andrew Joakimsen [mailto:andrew@envisionstudio.net] > > I don't see what the problem is, Asterisk will see them as twoseparate> extensions >Thanks for the response Andrew, Okay, in my case I don't have a set number of digits (taking into account all countries, etc.).> Exten => _9011xxxxxxxxx#,1,StripLSD(1) (or _9011.# if there isnot> a fixed number of digits, change the other xxxxxxx to be .)exten => _9011.#,1,StripLSD(1) ; will work for me, no bother creating ; a 2nd exten for intl calls But now that I've stripped the #, would the following work: exten => _9011.#,2,Dial(IAX2/{EXTEN:1}) or would EXTEN now match on _9011. only? If that's the case, it might mess up my other intl exten of: exten => _9011.,1,Dial(IAX2/{EXTEN:1}) exten => _9011.,2,Congestion Many ways to skin the cat, looking for the best solution. Regards, --- Gavin
Tilghman Lesher
2003-Oct-26 23:54 UTC
[Asterisk-Users] How to use the Cut() command to chop off an ending character
On Friday 24 October 2003 13:23, Adams, Gavin wrote:> So, I would like to be able to selectivity chop off any # characters > at the end of string, only if they exist. Basically as follows > (chopping off the leading '9' with ${EXTEN:1} syntax:exten => _X.,1,Cut(newexten=EXTEN,#,1) exten => _X.,2,Goto(${newexten}|3) exten => _X.,3,WhateverElse -Tilghman