AMI Originate call with custom CallerID


(Sidar Trk) #1

Hi, I’m try to writing a simple dialer with NodeJS for our CRM with WEBRTC support. I want to start a call with originate command using by AMI, then move this call to a queue. Asterisk takes care of the rest.

I’m doing what I want with the command below but the problem is that the CallerID parameter is probably not working correctly.

The problem is that both the phone user and the transferred extension see the same Caller ID. The extension must see real number which i sent from the channel parameter and called by asterisk and phone user must see callerid which i sent with Callerid parameter at originate command.

i tried context: from-internal, context: ext-queues and custom dialplan too.

I guess that should work like that bu it doesnt. How can i fix that.
Thanks.

Action: Originate
ActionID: b9c587ce-ee7d-4162-c9f4-06a7ccf09c08
Channel: PJSIP/00493442854382@mytrunk
Exten: 1999
Context: from-internal
Priority: 1
Async: true
CallerID: 0049876543210 <0049876543210>
ChannelId: 33149e43

I tried to set callerid at the beginning of from-queue macro codes when a call join queue but it makes another problems.

Also this is my custom dialplan bu in my dialplan i have another problems. How can i do this easily.

[queueplan]
exten => _X.,1,Verbose(3,---------> Q DEBUG CALLEE: ${CALLEE})
exten => _X.,2,Verbose(3,---------> Q DEBUG QUEUE: ${QUEUE})
exten => _X.,3,Set(CALLERID(all)=${CALLEE})
exten => _X.,4,Set(thisQueue=${QUEUE})
exten => _X.,5,GotoIf($["${thisQueue}" = ""]?invalid_queue,1)
exten => _X.,6,Verbose(2, ---------> Entering the ${thisQueue} queue)
exten => _X.,7,Queue(${thisQueue},t,,,900,,,,,)
exten => _X.,8,Hangup()

[dialerplan]
exten => _X.,1,Verbose(3,---------> DEBUG EXTEN: ${EXTEN})
exten => _X.,2,Verbose(3,---------> DEBUG CHANNEL: ${CHANNEL})
exten => _X.,3,Verbose(3,---------> DEBUG CALLERID(num): ${CALLERID(num)})
exten => _X.,4,Verbose(3,---------> DEBUG CALLERID(name): ${CALLERID(name)})
exten => _X.,5,Verbose(3,---------> DEBUG UNIQUEID: ${UNIQUEID})
exten => _X.,6,Verbose(3,---------> DEBUG CALLEE: ${CALLEE})
exten => _X.,7,Verbose(3,---------> DEBUG CALLER: ${CALLER})
exten => _X.,8,Verbose(3,---------> DEBUG QUEUE: ${QUEUE})
exten => _X.,9,Verbose(3,---------> DEBUG CALLER_ID: ${CALLER_ID})
exten => _X.,10,Verbose(3,---------> DEBUG HANGUPCAUSE: ${HANGUPCAUSE})
exten => _X.,11,Set(CALLERID(all)=${CALLER_ID})
exten => _X.,12,Dial(PJSIP/${CALLEE}@${CALLER},60),
exten => _X.,13,Goto(queueplan,${QUEUE},1)
exten => _X.,14,Hangup()
exten => h,15,noop(${HANGUPCAUSE})

Action: Originate
ActionID: f96bd1fe-1964-4f0a-a3bf-a376660c2128
Channel: PJSIP/00493442812382@mytrunk
Exten: 1999
Context: dialerplan
Priority: 1
Async: true
Variable: CALLEE=00493442812382,CALLER=mytrunk,QUEUE=1999,CALLER_ID=0049333222111
CallerID: 0049333222111 <0049333222111>
ChannelId: 3375643


(Itzik) #2

Set this to the caller ID you want the agent to see, and instead of doing this:

Call a local channel/context and change the caller ID there.


(David55) #3

See https://community.asterisk.org/t/ami-originate-callerid-problem/88870 for the history of this.


(Sidar Trk) #4

It’s working like this. Now, i have to improve the code.
Thanks for help.

[localdialer]
exten => _X.,1,Set(CALLERID(all)=${CALLER_ID})
exten => _X.,2,Dial(PJSIP/${EXTEN}@${CALLER})
exten => _X.,3,Congestion

Action: Originate
ActionID: f3013f18-196f-40df-c353-8d00d6dd2441
Channel: Local/00493378597269@localdialer
Exten: 1999
Context: from-internal
Priority: 1
Async: true
Variable: CALLEE=00493378597269,CALLER=mytrunk,QUEUE=1999,CALLER_ID=0049333777888
ChannelId: 3375643


(system) closed #5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.