[OpenSIPS-Users] xmpp configuration

Indiver nehru.indu at gmail.com
Mon Dec 28 20:50:04 CET 2009


Hi Anca,
I digged in to that problem and make some changes in opensips.cfg file. I'm
pasting my cfg  as i avoided other routing scripts for time being:

####### Global Parameters #########

debug=6
fork=no
#log_facility=LOG_LOCAL0
log_stderror=yes
children=4

/* uncomment the following lines to enable debugging */
#debug=6
#fork=no
#log_stderror=yes

/* uncomment the next line to disable TCP (default on) */
#disable_tcp=yes

/* uncomment the next line to enable the auto temporary blacklisting of not
available destinations (default disabled) */
#disable_dns_blacklist=no

/* uncomment the next line to enable IPv6 lookup after IPv4 dns lookup
failures (default disabled) */
#dns_try_ipv6=yes

/* uncomment the next line to disable the auto discovery of local aliases
based on revers DNS on IPs (default on) */
auto_aliases=yes

/* uncomment and configure the following line if you want opensips to bind
on a specific interface/port/proto (default bind on all available) */

listen=udp:auaccountonline.com
port=5060

# ------------------ module loading ----------------------------------
#set module path
mpath="/usr/local/lib64/opensips/modules"

#Uncomment this if you want to use SQL database
#loadmodule "mysql.so"
loadmodule "sl.so"
loadmodule "tm.so"
loadmodule "rr.so"
loadmodule "maxfwd.so"
loadmodule "usrloc.so"
loadmodule "signaling.so"
loadmodule "registrar.so"
loadmodule "textops.so"
loadmodule "mi_fifo.so"
loadmodule "xmpp.so"
loadmodule "auth.so"
loadmodule "auth_db.so"
loadmodule "db_mysql.so"
loadmodule "domain.so"

# Uncomment this if you want digest authentication
# mysql.so must be loaded !
#loadmodule "auth.so"
#loadmodule "auth_db.so"
# ----------------- setting module-specific parameters ---------------
# -- mi_fifo params --
modparam("mi_fifo", "fifo_name", "/tmp/openser_fifo")
# -- usrloc params --
modparam("usrloc", "db_mode", 0)
# Uncomment this if you want to use SQL database
# for persistent storage and comment the previous line
#modparam("usrloc", "db_mode", 2)
# -- auth params --
# Uncomment if you are using auth module
#
#modparam("auth_db", "calculate_ha1", yes)
                               
   
    # If you set "calculate_ha1" parameter to yes (which true in this
config),
    # uncomment also the following parameter)
    #
    #modparam("auth_db", "password_column", "password")
    # -- rr params --
    # add value to ;lr param to make some broken UAs happy
    modparam("rr", "enable_full_lr", 1)


# ----- auth_db params -----
/* uncomment the following lines if you want to enable the DB based 
authentication */
modparam("auth_db", "calculate_ha1", yes)
modparam("auth_db", "password_column", "password")
modparam("auth_db",
"db_url","mysql://opensips:opensipsrw@localhost/opensips")

#usrloc
modparam("usrloc", "db_mode", 2)
modparam("usrloc", "db_url",
"mysql://opensips:opensipsrw@localhost/opensips") 
# ----- domain params -----
/* uncomment the following lines to enable multi-domain detection
   support */
modparam("domain",
"db_url","mysql://opensips:opensipsrw@localhost/opensips")
modparam("domain", "db_mode", 1)   # Use caching

#xmpp param
modparam("xmpp", "domain_separator", "*")
modparam("xmpp", "gateway_domain", "ac.auaccountonline.com")
modparam("xmpp", "xmpp_domain", "debian64")
modparam("xmpp", "xmpp_host", "debian64")
modparam("xmpp", "xmpp_port", 5347)
modparam("xmpp", "xmpp_password", "admin")

#modparam("xmpp", "backend", "server")
modparam("xmpp", "backend", "component")

    # -------------------------       request routing logic
-------------------
    # main routing logic
route
{
             
             if (!mf_process_maxfwd_header("10"))
             {
                        sl_send_reply("483","Too Many Hops");
                        exit;
             };
             if (msg:len >= 2048 ) 
             {
                        sl_send_reply("513", "Message too big");
                        exit;
             };
             
             if (!method=="REGISTER")
             record_route();
             
             if (loose_route()) 
             {
                        # mark routing logic in request
                        append_hf("P-hint: rr-enforced\r\n");
                        route(1);
             };
             if (!uri==myself)
             {
                        # mark routing logic in request
                        append_hf("P-hint: outbound\r\n");
                        # if you have some interdomain connections via TLS
                        #if(uri=~"@tls_domain1.net") 
                        #{
                        #       t_relay("tls:domain1.net");
                        #       exit;
                                        

                        #} 
                        #else if(uri=~"@tls_domain2.net") 
                        #{
                        #t_relay("tls:domain2.net");
                        #exit;
                         #}
                route(1);
             };
        
            if (uri==myself)
            {
                if (method=="REGISTER") 
                {
                         # Uncomment this if you want to use digest
authentication
                         #if (!www_authorize("openser.org", "subscriber")) {
                         #        www_challenge("openser.org", "0");
                         #        exit;
                         #};
                         save("location");
                         exit;
                };
                lookup("aliases");
                if (!uri==myself) {
                         append_hf("P-hint: outbound alias\r\n");
                         route(1);
                };
                if (method == "MESSAGE") 
         {
		log("*** xmpp-handled MESSAGE message.\n");
		if (xmpp_send_message())
                {
			sl_send_reply("200", "Accepted");
		} 
                else
                {
			sl_send_reply("404", "Not found");
		}
		return;
	}
		
	log("*** xmpp: unhandled message type\n");
	#t_reply("503", "Service unavailable");
         sl_send_reply("503", "Service Unavailable" ); 
	return;

                # native SIP destinations are handled using our USRLOC DB
                if (!lookup("location")) {
                         sl_send_reply("404", "Not Found");
                         exit;
                };
                append_hf("P-hint: usrloc applied\r\n");
           };
        route(1);
}
route[1]
{
        # send it out now; use stateful forwarding as it works
        # reliably even for UDP2TCP
        if (!t_relay()) 
        {
                sl_reply_error();
        };
        exit;
}
My host name is : debian64
When i trying to  send message from web client of ejabber to sip client i'm
getting error 404 error: The error log is as follows:

Dec 29 00:16:30 [12500] DBG:xmpp:xmpp_component_child_process: server read
[<message from='admin at debian64/jabberworld'
to='1000*auaccountonline.com at debian64' type='chat'><body>hai hai hai hai hai
hai hai </body></message>]
Dec 29 00:16:30 [12500] DBG:xmpp:stream_node_callback: stream callback: 1:
message
Dec 29 00:16:30 [12500] DBG:xmpp:stream_node_callback: XMPP IM received
Dec 29 00:16:30 [12500] DBG:tm:t_uac:
next_hop=<sip:1000 at auaccountonline.com>
Dec 29 00:16:30 [12500] DBG:core:mk_proxy: doing DNS lookup...
Dec 29 00:16:30 [12500] DBG:core:sip_resolvehost: no port, no proto -> do
NAPTR lookup!
Dec 29 00:16:30 [12500] DBG:core:get_record: lookup(auaccountonline.com, 35)
failed
Dec 29 00:16:30 [12500] DBG:core:sip_resolvehost: no valid NAPTR record
found for auaccountonline.com, trying direct SRV lookup...
Dec 29 00:16:30 [12500] DBG:core:get_record:
lookup(_sip._udp.auaccountonline.com, 33) failed
Dec 29 00:16:30 [12500] DBG:core:sip_resolvehost: no valid SRV record found
for _sip._udp.auaccountonline.com, trying A record lookup...
Dec 29 00:16:30 [12500] DBG:tm:dlg2hash: 40275
Dec 29 00:16:30 [12500] DBG:tm:print_request_uri:
sip:1000 at auaccountonline.com
Dec 29 00:16:30 [12500] DBG:tm:set_timer: relative timeout is 500000
Dec 29 00:16:30 [12500] DBG:tm:insert_timer_unsafe: [4]: 0x7ff4494404a0
(416800000)
Dec 29 00:16:30 [12500] DBG:tm:set_timer: relative timeout is 30
Dec 29 00:16:30 [12500] DBG:tm:insert_timer_unsafe: [0]: 0x7ff4494404d0
(446)
Dec 29 00:16:30 [12497] DBG:core:parse_msg: SIP Request:
Dec 29 00:16:30 [12497] DBG:core:parse_msg:  method:  <MESSAGE>
Dec 29 00:16:30 [12497] DBG:core:parse_msg:  uri:    
<sip:1000 at auaccountonline.com>
Dec 29 00:16:30 [12497] DBG:core:parse_msg:  version: <SIP/2.0>
Dec 29 00:16:30 [12497] DBG:core:parse_headers: flags=2
Dec 29 00:16:30 [12497] DBG:core:parse_via_param: found param type 232,
<branch> = <z9hG4bK35d9.4a9a8903.0>; state=16
Dec 29 00:16:30 [12497] DBG:core:parse_via: end of header reached, state=5
Dec 29 00:16:30 [12497] DBG:core:parse_headers: via found, flags=2
Dec 29 00:16:30 [12497] DBG:core:parse_headers: this is the first via
Dec 29 00:16:30 [12497] DBG:core:receive_msg: After parse_msg...
Dec 29 00:16:30 [12497] DBG:core:receive_msg: preparing to run routing
scripts...
Dec 29 00:16:30 [12497] DBG:core:parse_headers: flags=100
Dec 29 00:16:30 [12497] DBG:core:parse_to: end of header reached, state=9
Dec 29 00:16:30 [12497] DBG:core:parse_to: display={},
ruri={sip:1000 at auaccountonline.com}
Dec 29 00:16:30 [12497] DBG:core:get_hdr_field: <To> [34];
uri=[sip:1000 at auaccountonline.com]
Dec 29 00:16:30 [12497] DBG:core:get_hdr_field: to body
[sip:1000 at auaccountonline.com
]
Dec 29 00:16:30 [12497] DBG:core:get_hdr_field: cseq <CSeq>: <10> <MESSAGE>
Dec 29 00:16:30 [12497] DBG:core:get_hdr_field: content_length=28
Dec 29 00:16:30 [12497] DBG:core:get_hdr_field: found end of header
Dec 29 00:16:30 [12497] DBG:maxfwd:is_maxfwd_present: max_forwards header
not found!
Dec 29 00:16:30 [12497] DBG:core:parse_to_param:
tag=533cb9e91f4b999cf76861cbb9ed54ed-cf35
Dec 29 00:16:30 [12497] DBG:core:parse_to: end of header reached, state=29
Dec 29 00:16:30 [12497] DBG:core:parse_to: display={},
ruri={sip:admin*debian64 at ac.auaccountonline.com}
Dec 29 00:16:30 [12497] DBG:core:parse_headers: flags=200
Dec 29 00:16:30 [12497] DBG:rr:find_first_route: No Route headers found
Dec 29 00:16:30 [12497] DBG:rr:loose_route: There is no Route HF
Dec 29 00:16:30 [12497] DBG:core:grep_sock_info: checking if host==us:
23==23 &&  [auaccountonline.com] == [auaccountonline.com]
Dec 29 00:16:30 [12497] DBG:core:grep_sock_info: checking if port 5060
matches port 5060
Dec 29 00:16:30 [12497] DBG:core:grep_sock_info: checking if host==us:
23==23 &&  [auaccountonline.com] == [auaccountonline.com]
Dec 29 00:16:30 [12497] DBG:core:grep_sock_info: checking if port 5060
matches port 5060
Dec 29 00:16:30 [12497] DBG:registrar:lookup: '1000' Not found in usrloc
Dec 29 00:16:30 [12497] DBG:core:grep_sock_info: checking if host==us:
23==23 &&  [auaccountonline.com] == [auaccountonline.com]
Dec 29 00:16:30 [12497] DBG:core:grep_sock_info: checking if port 5060
matches port 5060
*** xmpp-handled MESSAGE message.
Dec 29 00:16:30 [12497] DBG:xmpp:cmd_send_message: cmd_send_message
Dec 29 00:16:30 [12497] DBG:core:parse_headers: flags=ffffffffffffffff
Dec 29 00:16:30 [12497] DBG:core:parse_headers: flags=18
Dec 29 00:16:30 [12497] DBG:xmpp:cmd_send_message: message from
<sip:admin*debian64 at ac.auaccountonline.com>
Dec 29 00:16:30 [12497] DBG:xmpp:cmd_send_message: using R-URI as
destination
Dec 29 00:16:30 [12497] DBG:core:parse_headers: flags=ffffffffffffffff
Dec 29 00:16:30 [12497] DBG:core:check_via_address: params 127.0.0.1,
127.0.0.1, 0
Dec 29 00:16:30 [12497] DBG:core:destroy_avp_list: destroying list (nil)
Dec 29 00:16:30 [12497] DBG:core:receive_msg: cleaning up
Dec 29 00:16:30 [12497] DBG:core:parse_msg: SIP Reply  (status):
Dec 29 00:16:30 [12497] DBG:core:parse_msg:  version: <SIP/2.0>
Dec 29 00:16:30 [12497] DBG:core:parse_msg:  status:  <200>
Dec 29 00:16:30 [12497] DBG:core:parse_msg:  reason:  <Accepted>
Dec 29 00:16:30 [12497] DBG:core:parse_headers: flags=2
Dec 29 00:16:30 [12497] DBG:core:parse_via_param: found param type 232,
<branch> = <z9hG4bK35d9.4a9a8903.0>; state=16
Dec 29 00:16:30 [12497] DBG:core:parse_via: end of header reached, state=5
Dec 29 00:16:30 [12497] DBG:core:parse_headers: via found, flags=2
Dec 29 00:16:30 [12497] DBG:core:parse_headers: this is the first via
Dec 29 00:16:30 [12497] DBG:core:receive_msg: After parse_msg...
Dec 29 00:16:30 [12497] DBG:core:forward_reply: found module tm, passing
reply to it
Dec 29 00:16:30 [12497] DBG:tm:t_check: start=0xffffffffffffffff
Dec 29 00:16:30 [12497] DBG:core:parse_headers: flags=22
Dec 29 00:16:30 [12497] DBG:core:parse_to_param:
tag=c97b4d1cb1f3d0da549e06a8d482ef63.3a9e
Dec 29 00:16:30 [12497] DBG:core:parse_to: end of header reached, state=29
Dec 29 00:16:30 [12497] DBG:core:parse_to: display={},
ruri={sip:1000 at auaccountonline.com}
Dec 29 00:16:30 [12497] DBG:core:get_hdr_field: <To> [76];
uri=[sip:1000 at auaccountonline.com]
Dec 29 00:16:30 [12497] DBG:core:get_hdr_field: to body
[sip:1000 at auaccountonline.com]
Dec 29 00:16:30 [12497] DBG:core:get_hdr_field: cseq <CSeq>: <10> <MESSAGE>
Dec 29 00:16:30 [12497] DBG:tm:t_reply_matching: hash 40275 label 815311268
branch 0
Dec 29 00:16:30 [12497] DBG:tm:t_reply_matching: REF_UNSAFE: after is 1
Dec 29 00:16:30 [12497] DBG:tm:t_reply_matching: reply matched
(T=0x7ff449440280)!
Dec 29 00:16:30 [12497] DBG:tm:t_check: end=0x7ff449440280
Dec 29 00:16:30 [12497] DBG:tm:reply_received: org. status uas=0, uac[0]=0
local=2 is_invite=0)
Dec 29 00:16:30 [12497] DBG:tm:t_should_relay_response: T_code=0,
new_code=200
Dec 29 00:16:30 [12497] DBG:tm:local_reply: branch=0, save=0, winner=0
Dec 29 00:16:30 [12497] DBG:tm:local_reply: local transaction completed
Dec 29 00:16:30 [12497] DBG:tm:cleanup_uac_timers: RETR/FR timers reset
Dec 29 00:16:30 [12497] DBG:tm:insert_timer_unsafe: [2]: 0x7ff449440300
(421)
Dec 29 00:16:30 [12497] DBG:tm:t_unref: UNREF_UNSAFE: after is 0
Dec 29 00:16:30 [12497] DBG:core:destroy_avp_list: destroying list (nil)
Dec 29 00:16:30 [12497] DBG:core:receive_msg: cleaning up
Dec 29 00:16:30 [12500] DBG:xmpp:xmpp_component_child_process: got pipe cmd
2
Dec 29 00:16:30 [12500] DBG:xmpp:do_send_message_component:
do_send_message_component from=[sip:admin*debian64 at ac.auaccountonline.com]
to=[sip:1000 at auaccountonline.com] body=[hai hai hai hai hai hai hai ]
Dec 29 00:16:30 [12500] DBG:xmpp:xode_send: xode_send [<message
id='533cb9e91f4b999cf76861cbb9ed54ed-cf35'
from='admin*debian64*ac.auaccountonline.com at debian64' to='1000'
type='chat'><body>hai hai hai hai hai hai hai </body></message>]
Dec 29 00:16:31 [12500] DBG:xmpp:xmpp_component_child_process: server read
[<message from='1000' to='admin*debian64*ac.auaccountonline.com at debian64'
type='error' id='533cb9e91f4b999cf76861cbb9ed54ed-cf35'><body>hai hai hai
hai hai hai hai </body><error code='404'
type='cancel'><remote-server-not-found
xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></message>]
Dec 29 00:16:31 [12500] DBG:xmpp:stream_node_callback: stream callback: 1:
message
Dec 29 00:16:31 [12500] DBG:xmpp:stream_node_callback: XMPP IM received
Dec 29 00:16:31 [12500] DBG:xmpp:stream_node_callback: received message
error stanza
Dec 29 00:16:31 [12499] DBG:tm:utimer_routine: timer
routine:4,tl=0x7ff4494404a0 next=(nil), timeout=416800000
Dec 29 00:16:36 [12499] DBG:tm:timer_routine: timer
routine:2,tl=0x7ff449440300 next=(nil), timeout=421
Dec 29 00:16:36 [12499] DBG:tm:wait_handler: removing 0x7ff449440280 from
table
Dec 29 00:16:36 [12499] DBG:tm:delete_cell: delete transaction
0x7ff449440280
Dec 29 00:16:36 [12499] DBG:tm:wait_handler: done

But when i execute command dig auaccountonline.com i'm getting dns records
successfully. Is the above pasted cfg is necessary for to and fro
communications of xmpp-sip clients. Or any thing wrong with my config file.
I have been stuck on this issues from last one week. can you figure it out.
Thanks in  Advance.

Anca Vamanu-2 wrote:
> 
> Hi,
> 
> The problem is very clear from the replies that you get - the SIP 
> Message sent to the xmpp account goes into the part with lookup 
> location. You have to call
> xmpp_send_message function before that so that the message is handled by 
> the gateway instead.
> 
> Regards,
> 
> -- 
> Anca Vamanu
> www.voice-system.ro
> 
> 
> 
> Indiver wrote:
>> Hi Anca .
>> As per your suggestions i can add sip buddy from xmpp client. I can even
>> send messages to sip client. But the problem is i cannot reply back to
>> the
>> xmpp buddy. It is getting 403 forbidden error some times and 407 Proxy
>> authentication error some times. I tried to add xmpp buddy in sip client
>> as
>> follows
>>  sip:username<delim>jabber_server at gateway_domain
>> But in vain. Is any further modifications required in opensips in order
>> to
>> send message to xmpp buddy?. cause that in the error log it is searching
>> for
>> xmpp buddy in usr loc table and it was unable to find that and displaying
>> 403 forbidden error. Can u suggest me where i went wrong.Thanks in
>> Advance!
>>
>> Anca Vamanu-2 wrote:
>>   
>>> Hi Indiver,
>>>
>>> The 'destination address' refers to the address of the buddy in the 
>>> contact list. So in the xmpp account you must add the SIP buddy with the 
>>> address:
>>>
>>> "sip_username<delim>opensips_domain at xmpp_domain"
>>>
>>> xmpp_domain - must be the domain used by opensips when registering as a 
>>> component in jabberd2. And the xmpp srv record for that domain must 
>>> point to the ip of the machine where jabberd2 is running.
>>>
>>> In SIP, the xmpp buddy must have the following address format:
>>>
>>> "sip:username<delim>jabber_server at gateway_domain"
>>>
>>> The gateway_domain is the domain of the opensips gateway. This address 
>>> format is used to ensure that the message gets to the gateway. The 
>>> gateway will the decode the address and get the right xmpp address of 
>>> the target : username at jabber_server.
>>>
>>> Regards,
>>>
>>> -- 
>>> Anca Vamanu
>>> www.voice-system.ro
>>>
>>>
>>>
>>> Indiver wrote:
>>>     
>>>> Hi Every one,
>>>>
>>>> I'm working on xmpp module of opensips. I  configured opensips as
>>>> component
>>>> mode. I installed jabberd2 and configured successfully. When i look up
>>>> the
>>>> logs of opensips it showing the handshake successful message with my
>>>> local
>>>> jabberd2 server installed in my system. This make foolish but i'm
>>>> confused
>>>> how to move on from here. As i must configure sipcommunicator(jabber
>>>> client)
>>>> with my local jabberd2 server user name and password(i.e u
>>>> name:jabberd2
>>>> password:secret)or with the pattern suggested in xmpp doc.Cause that  i
>>>> can't understand the format i read in xmpp module of opensips doc.Below
>>>> is
>>>> the part mention in the xmpp doc i confused about, so i'm pasting that
>>>>
>>>> In both cases, the destination address must have the same pattern:
>>>>
>>>> “sip:username<delim>jabber_server at gateway_domain>>>>
>>>> From a jabber client's point of view, the destination will look like:
>>>>
>>>> “sip_username<delim>opensips_domain at xmpp_domain” .
>>>>
>>>> what does it mean? .   can any one suggest how to move on from here in
>>>> order
>>>> to test configured xmpp module.Thanks in advance
>>>>   
>>>>       
>>> _______________________________________________
>>> Users mailing list
>>> Users at lists.opensips.org
>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>
>>>
>>>     
>>
>>   
> 
> 
> 
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
> 
> 

-- 
View this message in context: http://n2.nabble.com/xmpp-configuration-tp4192010p4224956.html
Sent from the OpenSIPS - Users mailing list archive at Nabble.com.



More information about the Users mailing list