[Home]

Summary:ASTERISK-07781: Make Realtime SIP Clusterable - Message Waiting Not Working
Reporter:Bill Kunyiha (bgitonga)Labels:
Date Opened:2006-09-20 16:32:23Date Closed:2011-06-07 14:03:15
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Channels/chan_sip/DatabaseSupport
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:This is a reopening of 0004687
MWI does not work if you want to use multiple machines with phones registered to any machine.
Anthm had this taken care of in his patch (0004832: [patch] Make Realtime SIP Clusterable) but for some reason the patch was brocken during the commit.
I had to edit chan_sip.c and allow caching to take place even when rtcachefriends =no for MWI to work(ie make [phone a] registered to [asterisk a] to call [phone b] regisred to [asterisk b] with both asterisks using the same mysql database in asterisk realtime).
Please note that the cluster only works when rtcachefriends =no.

The original bug 0004687 is shown below.


With rtcachefriends = yes in sip.conf, my SIP phone registered to Asterisk Server A cannot dial another SIP phone registered to Asterisk Server B. The error message is: "Cannot create channel of type SIP (Cause 3 - no route to destination)".

The two phones _can_ call each other if I set rtcachefriends = no. The common extensions.conf simply uses Dial(SIP/extension) to dial extensions.

Both Asterisk servers are using identical MySQL databases, kept in sync using replication. The sipusers tables in both databases show the correct dynamic IP address and port for both phones, indicating that the phones did register successfully. And the dynamic registration information is reflected in both databases because of the MySQL replication.

However, running "sip show peers" on Server A only shows the phone registered to Server A. Running the same command on Server B only shows the phone registered to Server B.

So despite the fact that phone B's registration data (IP address and port) is in Server A's database, the Asterisk on Server A doesn't know how to route the call to phone B. It looks like Asterisk is using cached data and ignoring the database, but the registration info for phone B never got into the cache.

I need rtcachefriends enabled, because I need MWI to work.
Comments:By: Joshua C. Colp (jcolp) 2006-09-21 13:12:25

Do you have rtupdate=yes and rtautoclear=yes? The first one causes the database to be updated when they register again and are a realtime peer. The second one causes the SIP peer to be automatically cleared when their registration expires. It should then pick up the new information.

By: Bill Kunyiha (bgitonga) 2006-09-21 20:06:08

Yes.
I do have rtupdate=yes and rtautoclear=yes

By: Bill Kunyiha (bgitonga) 2006-10-04 14:14:00

The way i fixed this was by enabling chaching at all times even is set to no.
Chaching is needed for MWI to work.
I commented chan_sip.c as follows:

/* Peer found in realtime, now build it in memory */
       peer = build_peer(newpeername, var, !ast_test_flag((&global_flags_page2), SIP_PAGE2_RTCACHEFRIENDS));
       if (!peer) {
               ast_variables_destroy(var);
               return (struct sip_peer *) NULL;
       }
       //if (ast_test_flag((&global_flags_page2), SIP_PAGE2_RTCACHEFRIENDS)) {
               /* Cache peer */
               ast_copy_flags((&peer->flags_page2),(&global_flags_page2), SIP_PAGE2_RTAUTOCLEAR|SIP_PAGE2_RTCACHEFRIENDS);
               if (ast_test_flag((&global_flags_page2), SIP_PAGE2_RTAUTOCLEAR)) {
                       if (peer->expire > -1) {
                               ast_sched_del(sched, peer->expire);
                       }
                       peer->expire = ast_sched_add(sched, (global_rtautoclear) * 1000, expire_register, (void *)peer);
               }
               ASTOBJ_CONTAINER_LINK(&peerl,peer);
       //} else {
       if (!ast_test_flag((&global_flags_page2), SIP_PAGE2_RTCACHEFRIENDS)) {
               ast_set_flag(peer, SIP_REALTIME);
       }
       ast_variables_destroy(var);

       return peer;



By: Olle Johansson (oej) 2006-10-06 03:21:11

I really don't agree with extending cached realtime objects to the same functionality as static objects. We need to implement a third object, static objects we load from realtime in non-caching mode. What you need for MWI and Qualify support is not caching, because "caching" implies that we're free to release them when needed. You really want a new way of doing this.

The whole "caching" thing is too confusing and promises a bit more than it delivers.

By: Olle Johansson (oej) 2006-10-29 12:44:01.000-0600

No comment from reporter.