PJSIP Channel ID Customization

I have a requirement where i need to append caller number in channel to be able to identify the calls anywhere, example: currently the call coming from provider and its connecting through PJSIP with my diaplan but in asterisk console I can only see the pjsip+uniqueid, i want the calls to be displayed as pjsip+callernumber+uniqueid in queue and pjsip channel to identify which call is in which state or position.

curently: pjsip-0000000b What i want: /pjsip-791919291-0000000b

PBX-ASTR*CLI> pjsip show channelstats

                                         ...........Receive......... .........Transmit..........

BridgeId ChannelId … UpTime… Codec. Count Lost Pct Jitter Count Lost Pct Jitter RTT…

      pjsip-0000000b     00:07:28 ulaw    22336       0    0   0.000  22039       0    0   0.000   0.006

Objects found: 1

PBX-ASTRCLI> pjsip show chann
channel channels channelstats
PBX-ASTR
CLI> pjsip show channels
channels channelstats
PBX-ASTR*CLI> pjsip show channels

Channel: <ChannelId…> <State…> <Time…>
Exten: <DialedExten…> CLCID: <ConnectedLineCID…>

Channel: PJSIP/pjsip-0000000b/Queue Up 00:07:40
Exten: queue CLCID: “” <>

Objects found: 1

PBX-ASTR*CLI>

========================================================================
kindly help and guide me toward correct path to achieve this if possible.

thanks in advance

That is not configurable. Its format is coded in the C implementation, so if you truly did want to change it you’d have to modify the code.

1 Like

As I had some thoughts on how you would have to change the code, I will add to that.

The safest way would be to change the code in all the places where this information was output.

It might be possible to change chan_pjsip, but I suspect that the caller ID isn’t known at the time that the channel name is assigned.

There is a low level API, but it carries warnings that would, I think, make it effectively unusable on a live system, and it is not exposed by the CHANNEL function, even though the documentation for that fails to say whether name is read-only or read-write, and almost certainly because it would be unsafe to implement.

1 Like

After playing with some commands and reading the book and posts from the forum I figured it out a way to identify the caller number with its channel and caller number for all calls on both queue and in any point in diaplan (Using PHP did it automate).

Number of calls not in queues: 1
[{“Channel”:“PJSIP/pjsip-0000000b”,“CallerIDNum”:“772124215”}]

thanks for sharing your thoughts and ideas.

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