0

Try to making a simple dialer with NodeJS. Want to start a call with originate command using AMI, then move this call to a queue. Asterisk takes care of the rest. With the following command, i can do what i want but problem is CallerID parameter is not working.

I set trunk's callerid , when i try to make a manuel outbound call. Its working but not working originate command. How can i make this work ? It is not preferred to play with config files, but we can edit them if necessary.

ami.action('Originate',{
Channel: 'PJSIP/'+req.params.callee+'@'+req.params.caller,
Exten: req.params.ext,
Context: 'ext-queues',
Priority: 1,
Async: 'false',
Variable: req.params.actid,
ActionID:req.params.actid,
CallerID:req.params.callee+' <'+req.params.callee+'>'}

Channel: 'PJSIP/number@trunkname', Exten: 1099, Context: 'ext-queues', Priority: 1, Async: 'false' ActionID: '123', CallerID: 9876543210

miken32
  • 42,008
  • 16
  • 111
  • 154
Tysre
  • 1
  • 1

2 Answers2

0

Asterisk action Originate have CallerID field like described in docs

https://wiki.asterisk.org/wiki/display/AST/Asterisk+11+ManagerAction_Originate

Note, that the library you are using can use other notation of variable, consult with source code.

However it is highly NOT recommended to write your own dialler core, there will be many other issues under load. Check already created variants.

arheops
  • 15,544
  • 1
  • 21
  • 27
  • Thanks for reply. Originate command works fine for now with 'context: from-internal' but got another problem with callerid. Both phone user and extension see the same callerid. Extension must see calling number by asterisk and user must see callerid which i send with originate command. I try to figure out this issue at originate command. – Tysre Jun 07 '21 at 10:14
  • Manager protocol is plain text. Check it using tcpdump and see if CID is here. If it is, check in asterisk what your dialplan do, check provider SUPPORT change of callerid – arheops Jun 07 '21 at 12:12
0

To show the correct caller id on the outbound call you need to set the connectedline variable on the originate action

ami.action('Originate',{
  Channel: 'PJSIP/'+req.params.callee+'@'+req.params.caller,
  Exten: req.params.ext,
  Context: 'ext-queues',
  Priority: 1,
  Async: 'false',
  Variable: 'actid='+req.params.actid+',CONNECTEDLINE(all,i)='+req.params.callee+' <'+req.params.callee+'>',
  ActionID:req.params.actid,
  CallerID:req.params.callee+' <'+req.params.callee+'>'}
Shloime Rosenblum
  • 927
  • 11
  • 26