Change CID to dialed number

Hello Everyone, its been a little while!

Asterisk: 13.7.2

I have been playing around with a callback script I wrote in the override file:

 * The system collects a callback number from the caller and calls the collected number back.
 * When the system calls the collected number back and checks if the caller is really there (press 1 to continue). 
 * If the caller is there (presses 1) they are then transferred to a miscellaneous destination. 

This all works fine, but one enhancement I would like to add is that the caller ID changes from my trunk CID (which it currently is) to the number of the caller that the system called.

Any ideas on what I need to add to the override file to accomplish this?

Example:

 * Caller calls in and provides a number, 444.444.4444.
 * System collects the number, 444.444.4444, and hangs up.
 * System calls 444.444.4444 and confirms the caller is there before transferring to misc destination.

How do I make it so the caller ID that the misc destination sees is 444.444.4444 and not the trunk CID?

Thanks for any help or guidance you may be able to provide!

Just set it.

Set(CALLERID(NUM)=4444444444)

Your upstream trunk provider will have to allow you to send arbitrary caller ID’s so you will want to verify with them that they will allow you to do that.

A responsible upstream provider won’t allow you to dot this, but if yours does, please note that we can only tell you how to do this after you have removed FreePBX. If you want to achieve it with FreePBX dialplan present, you will need to ask the FreePBX people.

(Generally, responsible service providers will only allow you to present number that you have proved to them that you control. The half way position would be to send it with a status saying that it can’t be trusted, in which case the callee’s provider might suppress it.))

Thanks for the replies everyone, I think I am getting closer.

This is all internal, the misc destination is a queue in our Avaya CM. I am trying to keep the CID of the far end preserved so we can research issues more easily on the Avaya side (i.e. search for customers unique phone number in our Avaya analyzer tools instead of seeing just our Asterisk CID).

Set(CALLERID(NUM)=4444444444) might work, but I need to understand how to make it dynamic.

To clarify, here is the code (I removed the press 1, its not relevant to what I am trying to accomplish in this thread):

exten => s,1,Answer
exten => s,n,Wait(1)
exten => s,n,Playback(PleaseEnterYourCallBackNumber)
exten => s,n,Read(CALLBACK_ALT,10)
exten => s,n,SayDigits(${CALLBACK_ALT})
exten => s,n,Set(CALL=${CALLBACK_ALT})
exten => s,n,Set(DESTINATION=ext-miscdests,6,1)
exten => s,n,Set(SLEEP=5)
exten => s,n,System(/var/lib/asterisk/bin/callback ${CALL} ${DESTINATION} ${SLEEP} &)
exten => s,n,Playback(custom/callbacksoon)
exten => s,n,Hangup

We use this code to create a static callback time (i.e. “We will call you back in exactly X minutes”).

Assume my outgoing asterisk trunk CID is 555.555.5555

Referencing the above code, if the caller input 444.444.4444, Asterisk would call the caller back at the dynamic (customer input) 444.444.4444 in 5 seconds. Before the call goes to ext-miscdests,6,1, is there a way to change the caller ID that ext-miscdests,6,1 receives from 555.555.5555 to 444.444.4444?

I am open to adding something in between the misc destination and the callback if anyone has an idea of what I need to add.

Thanks again!

You didn’t provide the contents of the script, but assuming it uses Originate or a call file, you can either encode the information into the internal number to dial, and parse it out, or, only for AMI originate, I think, set it in a channel variable.

1 Like