How would I parse the area code from this variable? Number=2515551212 Sorry for the dense question, I don't seem to be able to find an appropriate function for parsing left to right.
${Number:-10:3} if I recall correctly would give you 3 characters starting at the 10th from the end. -Jonathan> -----Original Message----- > From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users- > bounces@lists.digium.com] On Behalf Of John French > Sent: Tuesday, December 19, 2006 10:35 AM > To: asterisk-users@lists.digium.com > Subject: [asterisk-users] Parsing Area Code from CallerID > > How would I parse the area code from this variable? Number=2515551212 > Sorry for the dense question, I don't seem to be able to find an > appropriate function for parsing left to right. > _______________________________________________ > --Bandwidth and Colocation provided by Easynews.com -- > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users
John French wrote:> How would I parse the area code from this variable? Number=2515551212 > Sorry for the dense question, I don't seem to be able to find an > appropriate function for parsing left to right. > _______________________________________________ > --Bandwidth and Colocation provided by Easynews.com -- > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users >NPA=${NUMBER:0:3} -- One day at a time, one second if that's what it takes
> -----Original Message----- > From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users- > bounces@lists.digium.com] On Behalf Of Bruce Ferrell > Sent: Tuesday, December 19, 2006 12:00 PM > To: Asterisk Users Mailing List - Non-Commercial Discussion > Subject: Re: [asterisk-users] Parsing Area Code from CallerID > > > John French wrote: > > How would I parse the area code from this variable?Number=2515551212> > Sorry for the dense question, I don't seem to be able to find an > > appropriate function for parsing left to right. > > _______________________________________________ > > --Bandwidth and Colocation provided by Easynews.com -- > > > > asterisk-users mailing list > > To UNSUBSCRIBE or update options visit: > > http://lists.digium.com/mailman/listinfo/asterisk-users > > > > NPA=${NUMBER:0:3} > > -- > One day at a time, one second if that's what it takesThat works if the number is always NPA-NXX-XXXX. If you end up with +1NPANXXXXXX or 1NPANXXXXXX then you don't have the right data. -Jonathan