<span style="font-family: Arial, Helvetica, sans-serif; font-size: 10pt"><span style="font-family: tahoma,arial,sans-serif; font-size: 10pt;"><hr width="100%" size="2" align="center" />
<b>From</b>: "Bryant Zimmerman" <BryantZ@zktech.com><br />
<b>Sent</b>: Thursday, July 07, 2011 4:14 PM<br />
<b>To</b>: "Asterisk Users Mailing List - Non-Commercial Discussion" <asterisk-users@lists.digium.com><br />
<b>Subject</b>: Re: [asterisk-users] Stripping characters from ${CALLERID(num)} ?</span><br />
<br />
<span style="font-family: arial, helvetica, sans-serif; font-size: 10pt;">Here is a simple way to strip the '-' <br />
<br />
Here is a concept solution.<br />
I have not tested the code so there may be some syntax errors. <br />
It can work as I am doing stuff like this all the time. This example is using a check to only do the cut if there is more than one field. You may be able to just use step 3 from ctx and have what you want, but I am not sure if it will fall back gracefully if there is only 1 field. <br />
<br />
No AGI required.<br />
<br />
exten => mycode,n,Gosub(ctx,1)<br />
<br />
exten => ctx,1,Set(l_filedCNT=${FIELDQTY(CALLERID(num),-)})<br />
exten => ctx,n,GotoIf($[${MATH(${l_filedCNT}>1)}=TRUE]?DoStrip:doSkip)<br />
exten => ctx,n(doStrip),Set (CALLERID(num)=${CUT(CALLERID(num), -, 1-)})<br />
exten => ctx,n(doSkip),NoOp(${CALLERID(num)})<br />
<br />
<br />
<div id="divSignature">Thanks<br />
zktech<br />
<br />
Made a correct in the above to reflect the skip state doSkip vs SkpStrip and made syntax correct to the Set/CUT line. There may still be a few more syntax issues in there.<br />
<br />
zktech<br />
<br />
</div>
</span><br /></span>