Decrypyt encrypted number in asterisk before sending to trunk

I am trying to implement a decryption program in asterisk.

Basically, the carrier sends me the destination numbers (B-Numbers) as encrypted numbers. They have also sent a python script to be used to decrypt the numbers before sending to the gateway.

I have loaded the python script on the server and created a custom destination to pass the Call through the script to decrypt the B-number
before sending the call to the gateway

I have created a context and routed the inbound calls to the context. From the cli, the call ends when it gets to the context and the script never gets executed.

Context:

[outbound20]
exten => _X.,1,NoOp(Entering custom script context)
 same => n,System(/usr/bin/python3  /custom/script.py ${CALLERID(num)})
 same => n,Dial(PJSIP/Trunk-name/${EXTEN})

The python script is the /custom/script.py file and is loaded correctly on the server with the necessary permissions

This is the error I get below when i tried a test call : The context gets into new stack but script never gets executed and call ends

"outbound20,_X.,1") in new stack

This is the asterisk log.
PS: The number: 7124613333055 is meant to be decodes by the python script

The call drops here

What does “custom destination” mean. It has no meaning to Asterisk. Is this a question that should have been asked on https://community.freepbx.org/ ?

Also please provide logs as plain text, not as images. Even the FreePBX people prefer that, especially as their logs are 100s of lines long.

When redacting, please indicate what the redacted text represents, clearly distinguishing between different instances of similar things.

This seems to be a continuation of Change number in the TO field before sending to gateway Please do not start multiple threads on the same issue.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.