How to manipulate from field on invite from Asterisk ARI orignate

Hi All,

I am looking for a solution, how I can send the proper value in the from field at originate.

Example of my sip.conf:

 register => <username>@<domainname>:<pwd>@<domainname>/<callerid>


[<callerid>]
type=peer
context=incoming
callerid=<callerid>
trustpid=no
sendrpid=no
canreinvite=no
fromdomain=<domainname>
fromuser=<username>
username=<username>
defaultusername=<username>
insecure=invite,port
disallow=all
allow=alaw, ulaw,
host=<domainname>
secret=<pwd>
nat=no

I use the following python call to originate the call:

enpointstr = 'SIP/' + b_nr + '@' + a_nr
response = ari_client.channels.originate(endpoint=enpointstr, app="ST-"+a_nr, callerId="SIP/" + a_nr, timeout=150)
	

If callerid=“SIP/” + a_nr then from field in the header of invite looks like:
From: “SIP/<a_nr?” <sip:<sip_cred>@>;tag=as1d2382f9

If callerid = a_nr
From: <sip:<sip_cred>@>;tag=as1d2382f9

I need the a_nr in from field as CLI, but without “SIP/”. Is there anyway to do this?

Thank you for your help

Remove fromuser. It takes precedence over anything set by the dialplan.

Yep, that was working. Thank you for your help

Hi Dave,

I have just double checked, and it is still not on the right format
I did remove the from user from sip.conf, also removed the SIP/ at the callerID, and now it looks like this:
<sip:<a_nr>>@>;tag=as7476dff5

and I need in the following format:
“<a_nr>” <sip:<sip_username>>@>;tag=as7476dff5

I don’t know the ARI specifics, but you seem to be overcomplicating this. You simply set the CALLERID(num) “function” to whatever you want to appear in the user part of the From header. I don’t understand why you are trying to put SIP/ or sip: in front of that in the first place,

You probably just want

callerId=a_nr

Ok, now I know what I did wrong.
I did put back the fromuser to the sip.conf with sip credentials, and I put the a_nr between “”, and now it works.