Start call using Originate with a custom callerid on Asterisk

1.4k views Asked by At

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

2

There are 2 answers

2
arheops On

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.

0
Shloime Rosenblum On

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+'>'}