[SR-Users] pua_xmpp questions
Daniel-Constantin Mierla
miconda at gmail.com
Sat Aug 13 12:39:59 CEST 2011
On 8/13/11 11:57 AM, laura testi wrote:
> You are right! Sorry for the inconvenience. Can you make diff in the
> correct order with the new files I have sent?
yes, applying such a patch with 'patch -R ...' gets it right. All is
fine, already in GIT master branch, I just wanted to be sure it was
nothing else forgotten.
Cheers,
Daniel
>
> Best Regards,
> Laura
>
> On Fri, Aug 12, 2011 at 10:58 PM, Daniel-Constantin Mierla
> <miconda at gmail.com> wrote:
>> Hello,
>>
>> I applied the patches to master branch. One seemed to be in the reverse
>> order (diff between file.new and file.old instead of diff between file.old
>> and file.new), can you double-check if that is ok? If fine, then I will
>> backport to 3.1 branch as well.
>>
>> Cheers,
>> Daniel
>>
>> On 8/10/11 1:44 PM, Daniel-Constantin Mierla wrote:
>>
>> Hi Laura,
>>
>> thanks, I will apply the patches soon.
>>
>> Cheers,
>> Daniel
>>
>> On 8/10/11 12:32 PM, laura testi wrote:
>>
>> Hi Daniel,
>> please find the attached diff files and the files patched.
>>
>> Best Regards,
>> Laura
>>
>> On Tue, Aug 9, 2011 at 4:34 PM, Daniel-Constantin Mierla
>> <miconda at gmail.com> wrote:
>>
>> Hi Laura,
>>
>> thanks for the patches. I will apply them. Can you attach the patches as
>> files instead of pasting them inline, so I can just download them from email
>> and apply? The mail client breaks the withe-spacing and will take me some
>> time to align them.
>>
>> Cheers,
>> Daniel
>>
>> On 8/8/11 6:00 PM, laura testi wrote:
>>
>> Thank you very much for your reply.
>>
>> Finally we have successfully configure the xmpp gateway to work (both
>> presence and IM) with another kamailio server which provide SIP
>> REGISTRAR/PROXY/PRESENCE (with integrated xcap function).
>>
>> The key points are to put the server address parameter of presence and
>> pua_xmpp module to the gateway itself instead of the main Presence
>> Server of the SIP/SIMPLE domains. But the outbound_proxy of the xmpp
>> module must point to the main PROXY server of the SIP/SIMPLE domains.
>> The outbound_proxy of pua is not specify, so it point itself.
>>
>> following are this part of the configuration:
>> modparam("xmpp", "outbound_proxy", "<main_proxy_uri>")
>> modparam("presence", "server_address", "sip:10.10.5.210:5060")
>> modparam("pua_xmpp", "server_address", "sip:10.10.5.210:5060")
>>
>> Now it works fine withe some bugs:
>> - xmpp add sip contact: ok
>> - sip add xmpp contact: ok
>> - xmpp see the sip contact presence: ok
>> - sip see the xmpp contact presence: ok
>> - sip IM to xmpp: ok
>> - xmpp IM to sip: ok
>>
>> the bugs we found are following:
>> - the online/offline status is ok in both direction (SIP<--> XMPP)
>> - other status (away/busy) is not ok from XMPP to SIP
>> - busy status is not ok from SIP to XMPP
>> - each time XMPP contact change the status, triger a new SUBSCRIBE in xmpp
>> gateway which generate multiple same subscriptions with different callid
>> in both active_watchers and pua tables. This also makes multiple
>> multiple NOTIFY
>> generation from the main Presence Server to GW when the SIP contact
>> change
>> it's status
>>
>> We have make the following patches in the pua_xmpp module that fix the
>> above bugs. Hope it can help.
>>
>> -------------------------------------------------------------------------------------------------------------------------
>> # diff -u simple2xmpp.c.orig simple2xmpp.c
>> --- simple2xmpp.c.orig 2011-08-05 16:11:55.000000000 +0200
>> +++ simple2xmpp.c 2011-08-08 14:57:25.000000000 +0200
>> @@ -87,7 +87,7 @@
>> if(msg->to->parsed != NULL)
>> {
>> pto = (struct to_body*)msg->to->parsed;
>> - LM_ERR("'To' header ALREADY
>> PARSED:<%.*s>\n",pto->uri.len,pto->uri.s);
>> + LM_DBG("'To' header ALREADY
>> PARSED:<%.*s>\n",pto->uri.len,pto->uri.s);
>> }
>> else
>> {
>> @@ -415,7 +415,8 @@
>> goto error;
>> }
>>
>> - if(xmlStrcasecmp((unsigned char*)note, (unsigned char*)"away")==
>> 0)
>> + if((xmlStrcasecmp((unsigned char*)note, (unsigned char*)"away")==
>> 0)||
>> + (xmlStrcasecmp((unsigned char*)note, (unsigned
>> char*)"On the phone")== 0))
>> {
>> new_node = xmlNewChild(xmpp_root, NULL, BAD_CAST "show",
>> BAD_CAST "away");
>> @@ -456,12 +457,14 @@
>> LM_ERR("while adding node:
>> idle\n");
>> goto error;
>> }
>> - }
>> - else */
>> + }*/
>> + else
>> if((xmlStrcasecmp((unsigned char*)note,
>> (unsigned char*)"dnd")== 0)||
>> (xmlStrcasecmp((unsigned
>> char*)note,
>> - (unsigned char*)"do
>> not disturb")== 0))
>> + (unsigned char*)"do
>> not disturb")== 0)||
>> + (xmlStrcasecmp((unsigned
>> char*)note,
>> + (unsigned char*)"Busy (DND)")==
>> 0))
>> {
>> new_node =
>> xmlNewChild(xmpp_root, NULL, BAD_CAST "show",
>> BAD_CAST "dnd");
>> @@ -471,6 +474,8 @@
>> goto error;
>> }
>> }
>> + else
>> + LM_DBG("Not Found Status\n");
>>
>>
>> /* adding status node */
>>
>>
>>
>>
>> -------------------------------------------------------------------------------------------------------------------------
>> # diff -u xmpp2simple.c.orig xmpp2simple.c
>> --- xmpp2simple.c.orig 2011-08-05 12:37:48.000000000 +0200
>> +++ xmpp2simple.c 2011-08-08 15:51:56.000000000 +0200
>> @@ -76,13 +76,13 @@
>> {
>> LM_DBG("type attribut not present\n");
>> build_publish(pres_node, -1);
>> - if(presence_subscribe(pres_node, 3600, XMPP_SUBSCRIBE)<
>> 0)
>> + /* if(presence_subscribe(pres_node, 3600, XMPP_SUBSCRIBE)<
>> 0)
>> {
>> LM_ERR("when sending subscribe for
>> presence");
>> xmlFree(pres_type);
>> goto error;
>> }
>> -
>> + */
>>
>> /* send subscribe after publish because in xmpp
>> subscribe message
>> * comes only when a new contact is inserted in buddy list
>> */
>> @@ -161,6 +161,8 @@
>> char* type= NULL;
>> char* status= NULL;
>>
>> +
>> +
>> LM_DBG("start\n");
>>
>> entity=(char*)pkg_malloc(7+ strlen(uri)*sizeof(char));
>> @@ -243,13 +245,13 @@
>> if(show_cont)
>> {
>> if(strcmp(show_cont, "xa")== 0)
>> - status= "not available";
>> + status= "Away";
>> else
>> if(strcmp(show_cont, "chat")== 0)
>> - status= "free for chat";
>> + status= "Online";
>> else
>> if(strcmp(show_cont, "dnd")== 0)
>> - status= "do not disturb";
>> + status= "Busy (DND)";
>> else
>> status= show_cont;
>> }
>> @@ -264,8 +266,8 @@
>> goto error;
>> }
>> */
>> - node = xmlNewChild(root_node, NULL, BAD_CAST "note",
>> - BAD_CAST status_cont);
>> + node = xmlNewChild(tuple_node, NULL, BAD_CAST "note",
>> + BAD_CAST status);
>> if(node== NULL)
>> {
>> LM_ERR("while adding node\n");
>> @@ -273,8 +275,8 @@
>> }
>> }else
>> if(show_cont)
>> - {
>> - node = xmlNewChild(root_node, NULL, BAD_CAST
>> "note",
>> + {
>> + node = xmlNewChild(tuple_node, NULL, BAD_CAST
>> "note",
>> BAD_CAST status);
>> if(node== NULL)
>> {
>> @@ -295,23 +297,6 @@
>> goto error;
>> }
>> }
>> - node= xmlNewChild(person_node, NULL, BAD_CAST
>> "activities",
>> - BAD_CAST 0);
>> - if(node== NULL)
>> - {
>> - LM_ERR("while adding node\n");
>> - goto error;
>> - }
>> -
>> -
>> - if( xmlNewChild(person_node, NULL, BAD_CAST "note",
>> - BAD_CAST status )== NULL)
>> - {
>> - LM_ERR("while adding node\n");
>> - goto error;
>> - }
>> -
>> -
>> }
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> On Mon, Aug 1, 2011 at 12:10 PM, Daniel-Constantin Mierla
>> <miconda at gmail.com> wrote:
>>
>> Hello,
>>
>> On 7/29/11 10:32 AM, laura testi wrote:
>>
>> Hi all,
>> we are trying to setup a kamailio presence server in SIP/SIMPLE domain
>> to interwork with XMPP domains including the GTalk (see the config
>> below). The architecture is like this:
>> - SIP/SIMPLE server: kamailio3.14 with full configuration with XCAP
>> integration
>> - XMPP Gateway: another kamailio server + ejabberd server
>> - component mode
>> - xmpp moduleL: outbound proxy to the Kamailio SIP/SIMPLE server
>> - pua_xmpp: no outbound proxy?
>> - XMPP server: ejabberd
>>
>> The users from XMPP domain can add the SIP account and see the
>> presence of the SIP users, but not vice versa. The chat from both
>> directions works fine.
>>
>> in the Presence Server, we have configured the kamailio with XCAP
>> integration. We have the following doubts:
>> - does pua_xmpp/pua modules need the xcap integration for the presence
>> integration with xmpp domains?
>>
>> no, there is no requirement of xcap for sip-xmpp presence gatewaying.
>>
>> because to use xcap for presence authorization rules, it needs the
>> sip clients support the xcap
>> - does pua_xmpp/pua support xcap? otherwise how to works?
>>
>> This mechanism of auth rules in SIP is not compatible with XMPP, afaik.
>> In
>> xmpp they have in-band (using XMPP) transfer of the buddy list, unlike in
>> SIMPLE where is XCAP over HTTP -- it is more like end-to-end presence
>> model
>> from early sip specifications.
>>
>>
>> - in case of multiple SIP/SIMPLE presence server, how we can configure
>> the server_address of
>> pua_xmpp and presence parameter in xmpp gw?
>>
>> Either use many instances or, as workaround, somehow route the traffic to
>> itself or other instance in order to re-write some headers.
>>
>> Cheers,
>> Daniel
>>
>>
>> Can you help us to clarify the doubts please?
>>
>> Many thanks in advanced!
>>
>> Best Regards,
>> Laura
>>
>>
>> PS: following are the main configuration of the xmpp GW:
>>
>>
>> ---------------------------------------------------------------------------------------------
>> ...
>> modparam("xmpp", "domain_separator", "*")
>> modparam("xmpp", "backend", "component")
>> modparam("xmpp", "gateway_domain", "<mygwdomain>")
>> modparam("xmpp", "xmpp_domain", "<mygwdomain>")
>> modparam("xmpp", "xmpp_host", "127.0.0.1")
>> modparam("xmpp", "xmpp_password", "secret")
>> modparam("xmpp", "outbound_proxy", "<my oubound proxy uri>")
>> modparam("pua", "outbound_proxy", "<my outbound proxy uri>")
>> modparam("pua", "update_period", 60)
>> modparam("pua", "default_expires", 1200)
>> modparam("presence", "server_address", "<my presence server uri>")
>> modparam("pua_xmpp", "server_address", "<my presence server uri>")
>>
>>
>>
>> route{
>> route(REQINIT);
>> t_check_trans();
>>
>> if (uri =~ "sip:.+ at .*<myxmppdomain>") {
>> route(PRESENCE);
>> if ($rU==$null)
>> {
>> # request with no Username in RURI
>> sl_send_reply("484","Address Incomplete");
>> exit;
>> }
>> route(CHAT);
>> }
>>
>> xlog("L_INFO", "*** xmpp: unhandled message type\n");
>> t_reply("503", "Service unavailable");
>> return;
>>
>> }
>>
>> ...
>>
>> route[CHAT] {
>> if(!is_method("MESSAGE"))
>> return;
>>
>> if (!t_newtran()) {
>> sl_reply_error();
>> exit;
>> }
>>
>> xlog("L_INFO", "*** xmpp-handled MESSAGE message.");
>> if ($cT=~"^text/plain") {
>> if (xmpp_send_message()) {
>> t_reply("200", "Accepted");
>> } else {
>> t_reply("404", "Not found");
>> }
>> } else {
>> xlog("L_INFO", "*** xmpp-handled MESSAGE, ignoring not
>> text
>> messages");
>> t_reply("200", "Accepted");
>> }
>>
>> t_release();
>> exit;
>> }
>>
>> route[PRESENCE] {
>> if(!is_method("PUBLISH|SUBSCRIBE|NOTIFY"))
>> return;
>>
>> # create new transaction to catch retransmissions
>> if (!t_newtran())
>> {
>> sl_reply_error();
>> exit;
>> }
>>
>> if( is_method("NOTIFY"))
>> {
>> xlog("L_INFO", "*** xmpp-handled NOTIFY message.");
>> if(pua_xmpp_notify())
>> t_reply("200", "OK");
>> t_release();
>> exit;
>> } else if( is_method("SUBSCRIBE"))
>> {
>> xlog("L_INFO", "*** xmpp-handled SUBSCRIBE message.\n");
>> handle_subscribe();
>> if($(hdr(Event))== "presence")
>> {
>> pua_xmpp_req_winfo("$ruri", "$hdr(Expires)");
>> }
>> t_release();
>> exit;
>> } else if(is_method("PUBLISH"))
>> {
>> handle_publish();
>> t_release();
>> exit;
>> }
>> }
>>
>> ...
>>
>> _______________________________________________
>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>> sr-users at lists.sip-router.org
>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>
>> --
>> Daniel-Constantin Mierla -- http://www.asipto.com
>> Kamailio Advanced Training, Oct 10-13, Berlin: http://asipto.com/u/kat
>> http://linkedin.com/in/miconda -- http://twitter.com/miconda
>>
>>
>> _______________________________________________
>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>> sr-users at lists.sip-router.org
>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>
>> --
>> Daniel-Constantin Mierla -- http://www.asipto.com
>> Kamailio Advanced Training, Oct 10-13, Berlin: http://asipto.com/u/kat
>> http://linkedin.com/in/miconda -- http://twitter.com/miconda
>>
>> _______________________________________________
>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>> sr-users at lists.sip-router.org
>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>
>> --
>> Daniel-Constantin Mierla -- http://www.asipto.com
>> Kamailio Advanced Training, Oct 10-13, Berlin: http://asipto.com/u/kat
>> http://linkedin.com/in/miconda -- http://twitter.com/miconda
>>
>> _______________________________________________
>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>> sr-users at lists.sip-router.org
>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>
>> --
>> Daniel-Constantin Mierla -- http://www.asipto.com
>> Kamailio Advanced Training, Oct 10-13, Berlin: http://asipto.com/u/kat
>> http://linkedin.com/in/miconda -- http://twitter.com/miconda
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla -- http://www.asipto.com
Kamailio Advanced Training, Oct 10-13, Berlin: http://asipto.com/u/kat
http://linkedin.com/in/miconda -- http://twitter.com/miconda
More information about the sr-users
mailing list