hi,
I can handle this for register method, but i loose the first session. Is there
any way to handle both of them ?
I mean, when I complete send REGISTER to kamailio, how can i send reply (401)
back to xlite(softphone) ?
Thank all,
ThanhTruong
________________________________
From: "Huang, Kun-Yao" <kxh...@dolby.com>
To: "sofia-sip-devel@lists.sourceforge.net"
<sofia-sip-devel@lists.sourceforge.net>
Sent: Thursday, June 13, 2013 12:12 PM
Subject: Re: [Sofia-sip-devel] sip register message construct
Hi Thanh:
I am currently using the following code and it works for me:
m_registrationHandle = nua_handle(m_nua, this, TAG_END());
std::stringstream from;
from << "sip:" << m_userName << "@" << registra;
m_registra = "sip:" + std::string(registra);
nua_register(m_registrationHandle,
NUTAG_REGISTRAR(m_registra.c_str()),
NUTAG_M_USERNAME(m_userName.c_str()),
SIPTAG_TO_STR(from.str().c_str()),
SIPTAG_FROM_STR(from.str().c_str()),
TAG_END());
Here is the register message captured:
REGISTER sip:10.1.1.1 SIP/2.0
Via: SIP/2.0/UDP 10.120.100.188;rport;branch=z9hG4bKBeB30SXcD9Z8Q
Max-Forwards: 70
From: <sip:user@10.1.1.1 >;tag=BeycFmB50X37B
To: <sip:user@10.1.1.1>
Call-ID: 7e830a08-4e88-1231-54ba-c1d1ecdb5c25
CSeq: 45213639 REGISTER
Contact: <sip user @10.120.100.188;transport=udp>
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, PRACK, MESSAGE, SUBSCRIBE, NOTIFY,
REFER, UPDATE, REGISTER, INFO
Supported: timer, 100rel, path
Content-Length: 0
For handling register authentication in callback I used:
if(evt == nua_r_register && (status == 401 || status == 407))
{
if (sip && sip->sip_www_authenticate &&
sip->sip_www_authenticate->au_params)
{
const char realm[] = "realm=\"";
for (const char *param = (const
char*)sip->sip_www_authenticate->au_params[0]; param != NULL; ++param)
{
size_t param_strlen = strlen(param);
if (param_strlen > sizeof(realm) &&
strncmp(realm, param, sizeof(realm) - 1) == 0)
{
std::string realm_val(param +
sizeof(realm) - 1, param_strlen - sizeof(realm));
std::stringstream digest;
digest << "Digest:\"" << realm_val <<
"\"" << ":" << m_userName << ":" << m_passWord;
nua_authenticate(m_registrationHandle,
NUTAG_AUTH(digest.str().c_str()), TAG_END());
}
}
}
}
From:ThanhTruong [mailto:ngoc217th...@yahoo.com]
Sent: Thursday, June 13, 2013 2:37 PM
To: Huang, Kun-Yao; sofia-sip-devel@lists.sourceforge.net
Subject: Re: [Sofia-sip-devel] sip register message construct
hi,
as I mention, softphone IP is 192.168.3.122, it send REGISTER message to FS
(192.168.1.112:5060) and I have tried to send it to kamailio
(192.168.1.112:5062) with bellow function.
But I get message back is 404 as last email.
How can i change "the host field of TO and FROM header be 192.168.3.122 instead
of 192.168.1.112" with nua ?
Thanks,
ThanhTruong
________________________________
From:"Huang, Kun-Yao" <kxh...@dolby.com>
To: "sofia-sip-devel@lists.sourceforge.net"
<sofia-sip-devel@lists.sourceforge.net>
Sent: Thursday, June 13, 2013 11:07 AM
Subject: Re: [Sofia-sip-devel] sip register message construct
I could be wrong, but should the host field of TO and FROM header be
192.168.3.122 instead of 192.168.1.112?
Kun-Yao
REGISTER sip:101@192.168.3.122:42806;rinstance=7742cc70900998e8 SIP/2.0
Via: SIP/2.0/UDP 192.168.1.112;rport;branch=z9hG4bKBB44UFQ9ySjQK
Max-Forwards: 70
From: <sip:192.168.1.112:5062>;tag=DXeN4j2DFt27j
To: "101" <sip:101@192.168.1.112>;tag=cd424d7d
On 13/06/2013, at 1:20 PM, ThanhTruong <ngoc217th...@yahoo.com>
wrote:
hi all,
I am very new in sofia sip, and I am develop one register module for FS using
sofia sip stack.
in FS, when i receive REGISTER message, i am trying to send it to another
registrar server (kamailio).
I have implement my code in incoming REGISTER message like:
nua_set_params(profile->nua,
SIPTAG_FROM_STR("sip:101@192.168.1.112:5062"),
NUTAG_ENABLEMESSAGE(1),
NUTAG_ENABLEINVITE(1),
NUTAG_AUTOALERT(1),
NUTAG_SESSION_TIMER(0),
NUTAG_AUTOANSWER(0),
TAG_NULL());
nua_register(nh,
NUTAG_PROXY("sip:192.168.1.112:5062"),
NUTAG_REGISTRAR("sip:192.168.1.112:5062"), //registra uri
SIPTAG_FROM_STR("sip:192.168.1.112:5062"),
NUTAG_INSTANCE (0),
NUTAG_M_USERNAME("101"),
TAG_NULL());
...
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel