Can not set User-agent in header

SB
Simon Beginn
Mon, Sep 17, 2018 9:11 AM

Hello,

i experience a bug (i guess) when I try to set the User-Agent-Field on
PjSUA:

I can reproduce the bug with both of the following code sippets to set
the User-Agent fields inside the REGISTER-Header:

---Snippets---

this->voip_sip_agent = "Test/1";
this->voip_config.user_agent.ptr = new
char[this->voip_sip_agent.length() + 1];
this->voip_config.user_agent.slen = this->voip_sip_agent.length();
strcpy(this->voip_config.user_agent.ptr, this->voip_sip_agent.c_str());

---or---

char tmp[80];
pj_ansi_snprintf(tmp, sizeof (tmp), "Unt/%s", "55");
pj_strdup2_with_null(pool, &this->voip_config.user_agent, tmp);

---End Snippets---

in both cases the REGISTER-Header / Package does not contain the new line:

REGISTER sip:**** SIP/2.0
Via: SIP/2.0/UDP
:5060;rport;branch=z9hG4bKPj9338855d-7017-491e-9052-8a445fd00260
Max-Forwards: 70
From: sip:****;tag=a72705df-aded-4696-9a7c-371783d427ba
To: sip:****
Call-ID: 4132f410-f284-4790-8de5-79ecd9fd9192
CSeq: 49685 REGISTER
Contact: sip:****;ob
Expires: 300
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY,
REFER, MESSAGE, OPTIONS
Authorization: Digest username="
", realm="",
nonce="W59vEFufbeT9+qTmACzJnP7zexkdSBJC", uri="
",
response="3fa79f6a1570cd7204822014780b3e2b"
Content-Length:  0

--end msg--

Does anyone has an advice, why this error occours or can anyone point me
the PjSIP source code where the REGISTER-Header-String is generated?

Thanks,

Simon

Hello, i experience a bug (i guess) when I try to set the User-Agent-Field on PjSUA: I can reproduce the bug with both of the following code sippets to set the User-Agent fields inside the REGISTER-Header: ---Snippets--- this->voip_sip_agent = "Test/1"; this->voip_config.user_agent.ptr = new char[this->voip_sip_agent.length() + 1]; this->voip_config.user_agent.slen = this->voip_sip_agent.length(); strcpy(this->voip_config.user_agent.ptr, this->voip_sip_agent.c_str()); ---or--- char tmp[80]; pj_ansi_snprintf(tmp, sizeof (tmp), "Unt/%s", "55"); pj_strdup2_with_null(pool, &this->voip_config.user_agent, tmp); ---End Snippets--- in both cases the REGISTER-Header / Package does not contain the new line: REGISTER sip:**** SIP/2.0 Via: SIP/2.0/UDP ****:5060;rport;branch=z9hG4bKPj9338855d-7017-491e-9052-8a445fd00260 Max-Forwards: 70 From: <sip:****>;tag=a72705df-aded-4696-9a7c-371783d427ba To: <sip:****> Call-ID: 4132f410-f284-4790-8de5-79ecd9fd9192 CSeq: 49685 REGISTER Contact: <sip:****;ob> Expires: 300 Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS Authorization: Digest username="****", realm="****", nonce="W59vEFufbeT9+qTmACzJnP7zexkdSBJC", uri="****", response="3fa79f6a1570cd7204822014780b3e2b" Content-Length:  0 --end msg-- Does anyone has an advice, why this error occours or can anyone point me the PjSIP source code where the REGISTER-Header-String is generated? Thanks, Simon