Error Asterisk 13 with PJSIP when try to use Alert-info:Bellcore-dr3

Hello, I am getting the warning and error bellow when start to use the Alert-info

[Jan 7 16:37:08] WARNING[6065][C-000001a8]: pbx.c:2866 pbx_extension_helper: No application 'SIPAddHeader' for extension (internal-route, 106, 15)

[Jan 7 16:42:26] ERROR[1572]: pjproject:0 <?>: sip_transport.c Error processing 902 bytes packet from UDP xx:xx:xx:xx:9457 : PJSIP syntax error exception when parsing 'Via' header on line 2 col 35:

When I added this in the dialplan:

same => n,SIPAddHeader(Alert-Info:Bellcore-dr3)

Can anyone help what I should to do to use SIPAddHeader?

PJSIP uses the PJSIP_HEADER dialplan function[1]. The parsing error is the result of an incoming SIP message, you’d need to examine the SIP message to see what is wrong.

[1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+17+Function_PJSIP_HEADER

Hello,

try: PJSIP_HEADER(action,name[,number])

Regards

I tested the code bellow in the dialplan, but didn’t work, didn’t arrive nothing in the header of the call.

same => n,Set(PJSIP_HEADER(add,Alert-Info)=“Bellcore-dr3”)
same => n,Dial({PJSIP_DIAL_CONTACTS({ext})},60,tT)

You need to do it in a pre-dial handler. Please see the second Note on the wiki page.

Thanks jcolp, but I tried with this 2 dialplan and didn’t work yet:


same => n,Set(PJSIP_HEADER(add,Alert-Info)=“Bellcore-dr3”)
same => n,Goto(call-bellcore,${ext},1)

[call-bellcore]
exten => _.,1,Dial({PJSIP_DIAL_CONTACTS({ext})},60,tT)
same => n,Answer()
same => n,Hangup()


same => n,Dial({PJSIP_DIAL_CONTACTS({ext})},60,tTb(bellcore^addheader^1))
same => n,Answer()
same => n,Hangup()

[bellcore]
exten => addheader,1,Set(PJSIP_HEADER(add,Alert-Info)=“Bellcore-dr3”)
exten => addheader,n,Return

What is actually output on the console during a call attempt?

The call now it’s working, the question is that the set of Bellcore-dr3 didn’t work.

you can check it at asterisk CLI after typing command - “pjsip set logger on”

like this
asteriskcti*CLI> pjsip set logger on
PJSIP Logging enabled

from now on, you can see the sip packets!

Thanks for the command, I didn’t know that, here is the log:

<--- Received SIP request (1065 bytes) from UDP:189.55.12.197:19574 --->
INVITE sip:106@sip.sss.com SIP/2.0
Via: SIP/2.0/UDP 189.55.12.197:19574;branch=z9hG4bK1025753903;rport
From: "Leandro Mi A2" <sip:19001003@sip.sss.com>;tag=912725081
To: <sip:106@sip.sss.com>
Call-ID: 677081000-19574-36@BJC.BGI.A.BAA
CSeq: 350 INVITE
Contact: "Leandro Mi A2" <sip:19001003@189.55.12.197:19574>
Max-Forwards: 70
User-Agent: Grandstream Wave 1.0.3.29
Privacy: none
P-Preferred-Identity: "Leandro Mi A2" <sip:19001003@sip.sss.com>
Supported: replaces, path, timer, eventlist
Allow: INVITE, ACK, OPTIONS, CANCEL, BYE, SUBSCRIBE, NOTIFY, INFO, REFER, UPDATE, MESSAGE
Content-Type: application/sdp
Accept: application/sdp, application/dtmf-relay
Content-Length:   324

v=0
o=19001003 8000 8000 IN IP4 189.55.12.197
s=SIP Call
c=IN IP4 189.55.12.197
t=0 0
m=audio 24422 RTP/AVP 0 8 18 101
a=sendrecv
a=rtcp:24423 IN IP4 192.168.0.100
a=rtpmap:0 PCMU/8000
a=ptime:20
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15

<--- Transmitting SIP response (519 bytes) to UDP:189.55.12.197:19574 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 189.55.12.197:19574;rport=19574;received=189.55.12.197;branch=z9hG4bK1025753903
Call-ID: 677081000-19574-36@BJC.BGI.A.BAA
From: "Leandro Mi A2" <sip:19001003@sip.sss.com>;tag=912725081
To: <sip:106@sip.sss.com>;tag=z9hG4bK1025753903
CSeq: 350 INVITE
WWW-Authenticate: Digest  realm="asterisk",nonce="1578478556/9721b04fcdfa83ad95bb5051e964744f",opaque="22618e88460f2291",algorithm=md5,qop="auth"
Server: Asterisk PBX 13.21.1
Content-Length:  0


<--- Received SIP request (327 bytes) from UDP:189.55.12.197:19574 --->
ACK sip:106@sip.sss.com SIP/2.0
Via: SIP/2.0/UDP 189.55.12.197:19574;branch=z9hG4bK1025753903;rport
From: "Leandro Mi A2" <sip:19001003@sip.sss.com>;tag=912725081
To: <sip:106@sip.sss.com>;tag=z9hG4bK1025753903
Call-ID: 677081000-19574-36@BJC.BGI.A.BAA
CSeq: 350 ACK
Content-Length: 0


<--- Received SIP request (1345 bytes) from UDP:189.55.12.197:19574 --->
INVITE sip:106@sip.sss.com SIP/2.0
Via: SIP/2.0/UDP 189.55.12.197:19574;branch=z9hG4bK806279348;rport
From: "Leandro Mi A2" <sip:19001003@sip.sss.com>;tag=912725081
To: <sip:106@sip.sss.com>
Call-ID: 677081000-19574-36@BJC.BGI.A.BAA
CSeq: 351 INVITE
Contact: "Leandro Mi A2" <sip:19001003@189.55.12.197:19574>
Authorization: Digest username="19001003", realm="asterisk", nonce="1578478556/9721b04fcdfa83ad95bb5051e964744f", uri="sip:106@sip.sss.com", response="fde31335f353908461f3220f4635bf0a", algorithm=md5, cnonce="16293382", opaque="22618e88460f2291", qop=auth, nc=00000002
Max-Forwards: 70
User-Agent: Grandstream Wave 1.0.3.29
Privacy: none
P-Preferred-Identity: "Leandro Mi A2" <sip:19001003@sip.sss.com>
Supported: replaces, path, timer, eventlist
Allow: INVITE, ACK, OPTIONS, CANCEL, BYE, SUBSCRIBE, NOTIFY, INFO, REFER, UPDATE, MESSAGE
Content-Type: application/sdp
Accept: application/sdp, application/dtmf-relay
Content-Length:   324

v=0
o=19001003 8000 8000 IN IP4 189.55.12.197
s=SIP Call
c=IN IP4 189.55.12.197
t=0 0
m=audio 24422 RTP/AVP 0 8 18 101
a=sendrecv
a=rtcp:24423 IN IP4 192.168.0.100
a=rtpmap:0 PCMU/8000
a=ptime:20
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15

  == Setting global variable 'SIPDOMAIN' to 'sip.sss.com'
<--- Transmitting SIP response (343 bytes) to UDP:189.55.12.197:19574 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 189.55.12.197:19574;rport=19574;received=189.55.12.197;branch=z9hG4bK806279348
Call-ID: 677081000-19574-36@BJC.BGI.A.BAA
From: "Leandro Mi A2" <sip:19001003@sip.sss.com>;tag=912725081
To: <sip:106@sip.sss.com>
CSeq: 351 INVITE
Server: Asterisk PBX 13.21.1
Content-Length:  0


    -- Executing [106@solarisTelecom:1] Goto("PJSIP/19001003-0000060e", "internal-route,106,1") in new stack
    -- Goto (internal-route,106,1)
    -- Executing [106@internal-route:1] ExecIf("PJSIP/19001003-0000060e", "0?Set(caller_id=):Set(caller_id=19001003)") in new stack
    -- Executing [106@internal-route:2] NoOp("PJSIP/19001003-0000060e", "") in new stack
    -- Executing [106@internal-route:3] NoOp("PJSIP/19001003-0000060e", "") in new stack
    -- Executing [106@internal-route:4] MYSQL("PJSIP/19001003-0000060e", "Connect connid localhost asterisk_db_user aStX#369@963ZaQ! db_asterisk") in new stack
    -- Executing [106@internal-route:5] Set("PJSIP/19001003-0000060e", "errmsg=MySQL connection error") in new stack
    -- Executing [106@internal-route:6] GotoIf("PJSIP/19001003-0000060e", "0?error,MySQL connection error,1") in new stack
    -- Executing [106@internal-route:7] MYSQL("PJSIP/19001003-0000060e", "Query resultid 1 SELECT x.cod_cli, y.nome, y.alias, z.context FROM (SELECT cod_cli, id_cli FROM user WHERE id_cli = (SELECT id_cli FROM user WHERE cod_cli = 19001003) AND alias = 106) x INNER JOIN (SELECT nome, alias, id_cli, cod_cli FROM user WHERE cod_cli = 19001003) y ON x.id_cli = y.id_cli INNER JOIN (SELECT aors, context FROM ps_endpoints WHERE aors = 19001003) z ON y.cod_cli = z.aors") in new stack
    -- Executing [106@internal-route:8] MYSQL("PJSIP/19001003-0000060e", "Fetch fetchid 2 ext name alias context") in new stack
    -- Executing [106@internal-route:9] MYSQL("PJSIP/19001003-0000060e", "Clear 2") in new stack
    -- Executing [106@internal-route:10] MYSQL("PJSIP/19001003-0000060e", "Disconnect 1") in new stack
    -- Executing [106@internal-route:11] Set("PJSIP/19001003-0000060e", "errmsg=No results error. Possibly non existing extension") in new stack
    -- Executing [106@internal-route:12] GotoIf("PJSIP/19001003-0000060e", "0?error,No results error. Possibly non existing extension,1") in new stack
    -- Executing [106@internal-route:13] Set("PJSIP/19001003-0000060e", "CALLERID(all)="Leandro Mi A2" <103>") in new stack
    -- Executing [106@internal-route:14] MixMonitor("PJSIP/19001003-0000060e", "solarisTelecom/20200108/1578478556.1556"_"071556"_"103"_"106".wav",b") in new stack
  == Begin MixMonitor Recording PJSIP/19001003-0000060e
    -- Executing [106@internal-route:15] Dial("PJSIP/19001003-0000060e", "PJSIP/47001006,60,tTb(bellcore^addheader^1)") in new stack
    -- PJSIP/47001006-0000060f Internal Gosub(bellcore,addheader,1) start
    -- Executing [addheader@bellcore:1] Set("PJSIP/47001006-0000060f", "PJSIP_HEADER(add,Alert-Info)="Bellcore-dr3"") in new stack
    -- Executing [addheader@bellcore:2] Return("PJSIP/47001006-0000060f", "") in new stack
  == Spawn extension (solarisTelecom, 106, 1) exited non-zero on 'PJSIP/47001006-0000060f'
    -- PJSIP/47001006-0000060f Internal Gosub(bellcore,addheader,1) complete GOSUB_RETVAL=
    -- Called PJSIP/47001006
<--- Transmitting SIP request (1036 bytes) to UDP:189.55.12.197:5060 --->
INVITE sip:47001006@189.55.12.197:5060 SIP/2.0
Via: SIP/2.0/UDP 54.233.x.x:5060;rport;branch=z9hG4bKPjf2eec951-c941-443f-86c3-1665687fca65
From: "Leandro Mi A2" <sip:103@172.31.9.156>;tag=da689d0d-7d3f-4c45-9fe4-072529923d35
To: <sip:47001006@189.55.12.197>
Contact: <sip:asterisk@54.233.x.x:5060>
Call-ID: 67114d1f-7ba2-4198-b0f5-cd783134ee1c
CSeq: 1360 INVITE
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub
Session-Expires: 1800
Min-SE: 90
Alert-Info: "Bellcore-dr3"
Max-Forwards: 70
User-Agent: Asterisk PBX 13.21.1
Content-Type: application/sdp
Content-Length:   331

v=0
o=- 281593645 281593645 IN IP4 54.233.x.x
s=Asterisk
c=IN IP4 54.233.x.x
t=0 0
m=audio 13118 RTP/AVP 18 3 0 8 101
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:3 GSM/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

<--- Received SIP response (501 bytes) from UDP:189.55.12.197:5060 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 54.233.x.x:5060;rport=5060;branch=z9hG4bKPjf2eec951-c941-443f-86c3-1665687fca65
From: "Leandro Mi A2" <sip:103@172.31.9.156>;tag=da689d0d-7d3f-4c45-9fe4-072529923d35
To: <sip:47001006@189.55.12.197:5060>
Call-ID: 67114d1f-7ba2-4198-b0f5-cd783134ee1c
CSeq: 1360 INVITE
Supported: replaces, path, timer
User-Agent: Grandstream GXP1625 1.0.4.55
Allow: INVITE, ACK, OPTIONS, CANCEL, BYE, SUBSCRIBE, NOTIFY, INFO, REFER, UPDATE, MESSAGE
Content-Length: 0


<--- Received SIP response (586 bytes) from UDP:189.55.12.197:5060 --->
SIP/2.0 180 Ringing
Via: SIP/2.0/UDP 54.233.x.x:5060;rport=5060;branch=z9hG4bKPjf2eec951-c941-443f-86c3-1665687fca65
From: "Leandro Mi A2" <sip:103@172.31.9.156>;tag=da689d0d-7d3f-4c45-9fe4-072529923d35
To: <sip:47001006@189.55.12.197:5060>;tag=355897652
Call-ID: 67114d1f-7ba2-4198-b0f5-cd783134ee1c
CSeq: 1360 INVITE
Contact: <sip:47001006@189.55.12.197:5060>
Supported: replaces, path, timer
User-Agent: Grandstream GXP1625 1.0.4.55
Allow-Events: talk, hold
Allow: INVITE, ACK, OPTIONS, CANCEL, BYE, SUBSCRIBE, NOTIFY, INFO, REFER, UPDATE, MESSAGE
Content-Length: 0


    -- PJSIP/47001006-0000060f is ringing
<--- Transmitting SIP response (531 bytes) to UDP:189.55.12.197:19574 --->
SIP/2.0 180 Ringing
Via: SIP/2.0/UDP 189.55.12.197:19574;rport=19574;received=189.55.12.197;branch=z9hG4bK806279348
Call-ID: 677081000-19574-36@BJC.BGI.A.BAA
From: "Leandro Mi A2" <sip:19001003@sip.sss.com>;tag=912725081
To: <sip:106@sip.sss.com>;tag=fd894b04-780e-42c7-ac01-9ec37d457946
CSeq: 351 INVITE
Server: Asterisk PBX 13.21.1
Contact: <sip:54.233.x.x:5060>
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, MESSAGE, REFER
Content-Length:  0

This is a Dial() of an attempt from extension 19001003 to extension 47001006 or (106).

Thank you for all that replies.

News, I discovered that some equipments are working with the Alert-Info on the header, other equipments not neither softphones, and the Alert-Info was inserted on the Header as the Log information.

Alfter all settings the issue was in the Grandstream IP telephone.

For this kind of equipments you should to setup each equipment the ring tone.