Need short code in From tag

Dear team,

Please let me know how i can add short code in from tag in header when sending the out bound

below is the current logs

From: sip:192.168.244.153;transport=udp;user=phone@192.168.244.153;tag=066523b3-9f08-48b2-a11e-76e51b4bc4d8

I need like below

From: “6001” sip:192.168.244.153;transport=udp;user=phone

Asterisk does not allow this and generally works at a higher level.

What does “short code” mean? What is the scenario?

Please provide the complete request, as copied and pasted directly from the log file, as this is malformed (should not have the second @192.168.244.153.

This would be a fatal violation of the SIP standards, as tag= is a mandatory part of the From header in all requests and responses.

RFC 3261:

The From field MUST contain a new “tag” parameter, chosen by the UAC.
See Section 19.3 for details on choosing a tag.

Even ignoring the conflict between your example (no tag) and narrative (customised tag), the RFC also says:

When a tag is generated by a UA for insertion into a request or
response, it MUST be globally unique and cryptographically random
with at least 32 bits of randomness.

Whilst appending a non-unique, non-random, value doesn’t actually compromise the uniqueness and randomness, as long as it is independent of the unique and random part, it is clearly a breach of the spirit of how tag is intended to be used.

As Joshua says, please explain what you are trying to achieve at a very high level, not the fine details of how you thought you would achieve it.

can you show us your pjsip.conf

Dears,

please find the below pjsip.conf

[6001]
type=endpoint
context=outdial
disallow=all
allow=ulaw
transport=transport-udp
auth=auth6001
aors=6001
send_pai=no
from_user=192.168.244.154;transport=udp;user=phone

[6001]
type=aor
max_contacts=1

[auth6001]
type=auth
auth_type=userpass
password=6001
username=6001

extension.conf

[predial]
exten =>_X.,1,Verbose(1, In Predial)
;same=>n,Set(CALLERID(num)=6001)
same=>n,Set(CALLERID(name)=6001)
same=>n,Set(PJSIP_HEADER(add,P-Asserted-Identity)=<sip:6001@192.168.244.154;transport=udp;user=phone>)
same=>n,Return

[outdial]
exten =>_X.,1,Verbose(1, set headers)
same=>n,Verbose(1, ${EXTEN})
same=>n,Set(CALLERID(num)=6001)
same=>n,Set(CALLERID(name)=6001)
same=>n,Verbose(1,${CALLERID(all)})
same=>n, Dial(PJSIP/${EXTEN},b(predial^${EXTEN}^1))

This is not a valid value. 192.168.244.154 is a domain, not a user, and the remaining items are URI parameters, not parts of the user. Moreeover, user=phone indicates that the suer part is in the form of a phone number, which 192.168.244.145 clearly is not.

that is broken
to get the “user=phone” you need to use this option “user_eq_phone”
also transport=udp is a separate config option and do not belong in from_user

unteste !

[transport](!)
type=transport
bind=0.0.0.0
tos=AF31
cos=3

[transport-udp](transport)
protocol=udp

[transport-tcp](transport)
protocol=tcp

[6001]
...
user_eq_phone=yes
transport=transport-udp
;from_user=192.168.244.154;transport=udp;user=phone

Thank you , now i am able to get the user=phone with caller id in From tag, but not able to get the transport=udp in From tag

below is the current pjsip.conf

[6001]
type=endpoint
context=outdial
disallow=all
allow=ulaw
transport=transport-udp
auth=auth6001
aors=6001
send_pai=no
user_eq_phone=yes

by using abow pjsip.conf we are getting the below From tag

Because transport=udp is the default, so it doesn’t need to be included explicitly.

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