Hi All When I dial a number it reaches the asterisk switch as abc at xyz@123.com what I need to do is to parse the abc and send it to my pstn gateway as in exten => _.,2,Dial(SIP/${EXTEN}@pstn.gw) this does work but I do have a varying number of numbers before the @ exten => _.,1,Dial(SIP/${EXTEN:0:12}@pstn.gw) Well can I use some kind of regular expression to take all numbers before the first @ and send them to the pstn something like exten => _.,1,Dial(SIP/${regexp(condition,Exten)}@pstn.gw) thx
Philipp Kempgen
2008-Apr-22 10:33 UTC
[asterisk-users] Parsing incoming extension till first @
Ali Jawad schrieb:> When I dial a number it reaches the asterisk switch as abc at xyz@123.com > what I need to do is to parse the abc and send it to my pstn gateway > as in > > exten => _.,2,Dial(SIP/${EXTEN}@pstn.gw) > > this does work but I do have a varying number of numbers before the @ > > exten => _.,1,Dial(SIP/${EXTEN:0:12}@pstn.gw) > > Well can I use some kind of regular expression to take all numbers > before the first @ and send them to the pstn > > something like > > exten => _.,1,Dial(SIP/${regexp(condition,Exten)}@pstn.gw)core show function CUT Regards, Philipp Kempgen -- amooma GmbH - Bachstr. 126 - 56566 Neuwied - http://www.amooma.de Let's use IT to solve problems and not to create new ones. Asterisk? -> http://www.das-asterisk-buch.de Gesch?ftsf?hrer: Stefan Wintermeyer Handelsregister: Neuwied B 14998
Using _. is going to result in warnings. A much better practice is to use _X. Ali Jawad wrote:> Thx again patrick it worked, I used > > [google-in] > exten => _.,1,Set(dst=${CUT(EXTEN,@,1)}) > exten => _.,1,Dial(SIP/${dst}@pstn.gw) > > while it should have been > > [google-in] > exten => _.,1,Set(dst=${CUT(EXTEN,@,1)}) > exten => _.,2,Dial(SIP/${dst}@pstn.gw) > > _______________________________________________ > -- 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 > > !DSPAM:480e5326213018190740810! > > >
Thanks for the hint Patrick I appreciate it. On Tue, Apr 22, 2008 at 3:02 PM, Rob Hillis <rob at hillis.dyndns.org> wrote:> Using _. is going to result in warnings. A much better practice is to > use _X. > > > > Ali Jawad wrote: > > Thx again patrick it worked, I used > > > > [google-in] > > exten => _.,1,Set(dst=${CUT(EXTEN,@,1)}) > > exten => _.,1,Dial(SIP/${dst}@pstn.gw) > > > > while it should have been > > > > [google-in] > > exten => _.,1,Set(dst=${CUT(EXTEN,@,1)}) > > exten => _.,2,Dial(SIP/${dst}@pstn.gw) > > > > > _______________________________________________ > > -- 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 > > > > !DSPAM:480e5326213018190740810! > > > > > > > > > > _______________________________________________ > -- 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 >-- -- With Regards Ali Jawad System Administrator http://www.alijawad.org Phone : +961-01-559031 Mobile : +961-03-041705 ---------------------------------------------------- Confidentiality Notice: The contents of this E-mail are intended for the named recipient only. It may contain confidential and privileged information. If you received it in error, please notify us immediately and then destroy it. Internet communications are not secure and therefore I do we do not accept legal responsibility for the contents of this message. Also, and though we provide every effort to keep our network free from viruses, you would need to check this E-mail and any attachments for viruses as we can take no responsibility for any computer virus which might be transferred by way of this E-mail.