I need to update the From and To uris before dialing the second leg , i’m using the pre-dial subroutines to update the headers before dialing , and when i use pjsip_header (add) its added successfully , but it leaves the original from in the sip header ,
when i use pjsip_header(update) it’s saying no header with that name to edit ,
so how can i fix the multiple To , From bug .
You can’t. There is no manipulation of the To or From headers, except as a result of things like changing callerid, from_user, and user in the dialed SIP URI.
There is no such functionality to update the From domain. There is no API access to update the headers beyond what is available like the callerid I mentioned.
I think it’s fair to say Asterisk tries to abstract away from low-level details of particular transports like SIP, analog lines, ISDN or whatever. If you want to do low-level SIP-specific stuff, then maybe look at alternative SIP-specific comms engines.