If we get an incoming call I can edit the callerID provided to add the leading ‘90’ and set the name so that sales calls can be identified according to the number called.
If however the callerID is unavailable then setting the callerID name or number fails (it shows as unavailable on the phone).
This is the call log from such an incoming call without callerID.
== Spawn extension (voip, 6204, 1) exited non-zero on ‘Zap/2-1’
– Hungup ‘Zap/2-1’
– Zap/3-1 answered SIP/6076-30ff
– Accepting call from ‘’ to ‘6201’ on channel 0/2, span 1
– Executing Set(“Zap/2-1”, “CALLERID(number)=90”) in new stack
– Executing Goto(“Zap/2-1”, “voip|6201|1”) in new stack
– Goto (voip,6201,1)
– Executing Macro(“Zap/2-1”, “uksales|Press”) in new stack
– Executing Set(“Zap/2-1”, “CALLERID(name)=Press”) in new stack
– Executing Dial(“Zap/2-1”, “SIP/6030&IAX2/6030&SIP/6514|15|t”) in
new stack
– Called 6030
I am running 1.2.0RC2 (dont ask Smile )
Here is the macro used to set the callerid.
[macro-uksales]
; UK SALES
; ARG1 = Caller ID Name to display on phone
exten => s,1,Set(CALLERID(name)=${ARG1})
exten => s,2,Dial(SIP/6030&IAX2/6030&SIP/6514,15,t)
exten => s,3,Voicemail(u6030)
exten => s,4,Hangup
exten => s,103,Goto(3)
Any ideas?
[quote=“gblades”]If we get an incoming call I can edit the callerID provided to add the leading ‘90’ and set the name so that sales calls can be identified according to the number called.
If however the callerID is unavailable then setting the callerID name or number fails (it shows as unavailable on the phone).
This is the call log from such an incoming call without callerID.
Any ideas?[/quote]
Try something like this.
exten => s,1,GotoIf($[${LEN(${CALLERID(name)}} = 0]?nocid|1)
exten => s,2,Set(CALLERID(name)=${ARG1})
exten => s,3,Set(CALLERID(num)=90${CALLERID(num)})
other stuff - dial phone, etc
exten => nocid,1,Set(CALLERID(name)="No Caller ID")
exten => nocid,2,Set(CALLERID(num)="0000000000")
exten => nocid,3,Goto(s,4)
where ARG1 is a name passed to the macro. You might need to enclose the phase being passed into ARG1 in quotes, eg:
exten 45643 => 1,1,Macro(dial-uksales,"Caller ID String");
Off-topic (sorta):
Personally, I like using agi scripts to manipulate and fool with callerid and numbers. There is a neat script included with the asterisk agi perl module that performs callerid lookups on the internet that can easily be extended. You might look into it if you have some spare time. My version performs a callerid lookup only if no callerid is presented. If callerid IS presented, it cleans up the name so its a bit more readable (First Last) instead of LAST FIRST which is what my telco send sometimes. I also log all of that data into mysql - so when a customer calls again - the “real, corrected” info is used instead of the abbreviated allcaps telco version is used. Eventually i’ll find a softphone that cat execute an arbitrary script on reciept of call (or write my own app) to popup a detailed dialog with any mysql data assocatiad with that number (like past trouble tickets, address, etc)
Thanks for the suggestion for handling the case where there is no callerid so that the number does not just show ‘90’. However the problem I am having is that when the incoming call has no callerid even if I set the callerID name and number it is being shown as ‘unavailable’ on the phone.
If the incoming call has callerid supplied then the macro works fine.