I’m having an issue with dynamic routes. I am trying to sort a call by its caller ID name, which contains the dialed number when it rings, and on both logs, the CDR and the console logs. The only thing I could think is happening is somehow it is getting the dialed number and changing when it is ringing as the dynamic route which tries to match $["${CALLERID(name)}"="0xxxxxxxxx"]" does not work. If you can think of any way to solve this it would be greatly appreciated.
This doesn’t work for some reason - could be that the From header contains bits outside of the “”, or it could be that the PJSIP_HEADER function isn’t returning data - which seems to have happened when I tried to put it in as a context.
From must contain a URI, and a tag parameter, and the bit in quotes is never the URI. The display name doesn’t always have to be in quotes, and if it is a pure number, that is one of the cases where quotes are optional.
You haven’t provided either the actual From header, or the code you are now using to parse it.
I’m pretty sure you can do all the necessary parsing without shelling out.
Using the From display name for the called number is a strange abuse of this field.
Yep that’s the way I’m using it currently - I came up with a parser to cut it out of the string $["${CUT(CUT(PJSIP_HEADER(read, From), ", 2), ", 1)}"="0xxxxxxxxxx"]
The From Header comes through as From: "0xxxxxxxxxx" <sip:[email protected]>;tag=as5c1f4d6
I believe the CUTs should take it out of the string, but for some reason beyond me it doesn’t work.
I have a log that says [2023-07-15 01:58:35] VERBOSE[311155][C-00000a2b] pbx.c: Executing [3385315e1@fixcallerid:1] Verbose("PJSIP/Sipgate-xxx-000000a4", "Trying to set ") in new stack that is sent out by this line in the context - exten => _X!,1,Verbose(Trying to set ${PJSIP_HEADER(read, From)})
Unless the context requires me to restart FreePBX instead of just reloading the config, I am unsure what is going on with that.
If one strange thing is being done, others may be as well; to help properly people need to see the whole picture (in this case, starting from a complete INVITE request). Also, if something strange is being done, it is better to remove it at source, including. possibly by changing the source.
I am looking for a solution to filter calls by the called number to then send it to different extensions.
Sorry for the late response, I was on holiday.
I’d suggest you ask sipgate to configure their system to work according to their documentation:
which wouldn’t require any jiggery-pokery, at all. On the other hand, the fact that there is a , two hop, web link loop on the click here for general instructions doesn’t bode well.