AMI Redirect with Caller ID

The following example is something I use to correctly transfer a call from an operator to an extension:

Action: Redirect
Channel: SIP/some-proxy-0000034e
Context: someContext
Priority: 1
Exten: 105

The net affect of this is to transfer the active call represented by “Channel: SIP/some-proxy-0000034e” to extension 105. This works, but when the phone represented by 105 rings, its called ID says “asterisk.”

I’d like to set the caller ID, but it seems as though I can only use the “CallerID” header with an originate action.

How can I accomplish modifying the caller Id text?

You could try to manipulate the CALLERID within someContext as it should AFAIK be accessible there if You refer to the channel-vars of SIP/some-proxy-0000034e (accessible at least via MASTER_CHANNEL)

Thanks. How would I pass the caller ID info from an AMI redirect to someContext? My first thought would be to use the variable header, but this header cannot be passed in with a redirect command.

As You’re redirecting the Channel to the context (someContext) You should be able to use/manipulate variables there within the dialplan logic.

I’ve written a short context in which the following resides:
; stuff
exten => _[#0-9a-zA-Z]., 1, Set(DISPLAYNAME=CallerIDText)
exten => _[
#0-9a-zA-Z]., n, Set(DISPLAYNUM=5551234)
exten => _[*#0-9a-zA-Z]., n, Goto(mainRoutingContext, ${EXTEN}, 1)
; more stuff
; once it’s routed to mainRoutingContext, that context correctly
; decides whether to use DISPLAYNAME/NUM or not (i.e. if they are
; not blank)

I then use the following AMI command:
Action: redirect
Channel: SIP/channel-to-transfer-0000f12 ;channel to transfer
Context: transferCallerID
Exten: 101 ;target extension to transfer channel to
Priority: 1
Async: yes

With this setup, I can redirect my existing channel to extension 101, and the user at phone 101 sees “CallerIDText <5551234>” on their caller ID display. The problem is that I cannot make this work with anything but hardcoded values. Also, I can only use Set(CALLERID(name/num)=${HASH(account, id)}) type caller ID functions when I am doing redirects between two internall extensions. When an external line calls in I need to set DISPLAYNAME/NUM somehow, but cannot find what to set them with and how to get that value there.

The crux is how to get these custom defined strings into transferCallerID so they can be set to other variables.


Here’s a temporary solution to this:


Action: SetVar
Channel: SIP/channel-to-set-vars-for-000012f
Variable: SOMEVAR
Value: DATA

1 Like

How might you do this with Action: Originate. Specifically, what context code should be modified or created?
And if this is a temporary solution, what lines are you thinking about for a more robust solution?

The callerID seems to be maintained when transferring a channel from one queue to another queue, but not when transferring from a queue to an agent.

Did you ever find a simpler fix for this issue?

EDIT: Ok, might only be an issue when I am doing this with internal channels. Calling my asterisk from my cellphone and transferring that channel from a queue to my extension seem to work just fine.

AMI Redirect won’t change the caller ID. If it is changing it is because the target extension is setting it.

1 Like