[Spce-user] Creating subscribers through the API

Dennis van der Vliet dennis at messagebird.com
Wed Apr 22 04:39:20 EDT 2015


Hi Andres,

I agree that this could potentially lead to a temporary inconsistency
between the database and the cache.

However if you look at how a domain is created through the webinterface (
https://github.com/sipwise/ngcp-panel/blob/master/lib/NGCP/Panel/Controller/Domain.pm#L99-L147)
you will see that this also can lead to inconsistencies between the cache
and database. A failure of the XML-RPC call on line 147 won't rollback the
transaction. So behaviour between the API and web interface seems to be
different.

Maybe both the frontend and api code should be changed to follow the
following steps:

1. Create record in database and commit to database
2. Run XML-RPC request in a try-catch
3. If step 2 fails rollback what was committed in step 1

Dennis




Best from Amsterdam,

Dennis van der Vliet | Senior Engineer

M: +31 6 53 47 44 96
E: dennis at messagebird.com
MessageBird
LinkedIn <https://nl.linkedin.com/in/dennisvandervliet> | Twitter
<https://twitter.com/dennisvdvliet>



On 20 April 2015 at 10:45, Andreas Granig <agranig at sipwise.com> wrote:

> Hi,
>
> From my point of view, the pull request will create data inconsistencies
> if the API fails to reload kamailio-proxy cache and prosody cache. It
> won't throw an error anymore if the cache reload fails, causing the
> domain to be existent in the DB but nonexistent in the cache, leading to
> "domain not served here" errors again, until you manually restart
> kamailio-proxy and prosody. That's why we put the cache reload into the
> same transaction.
>
> There might probably be an issue here, but this patch is not going to
> solve it correctly. It'd be interesting to see the api.log when creating
> a domain. If the API call fails, please send the content of the log. If
> the API call is ok but you still get a "domain not served here", then
> it'd be interesting to check the output of
>
> ngcp-sercmd proxy domain.dump
>
> for the kamailio part and
>
> telnet localhost 5582
> host:list()
>
> for the prosody part.
>
> It has been reported from time to time that the ip and/or port part of
> prosody is wrong in
>
> mysql provisioning -e 'select * from xmlhosts'
>
> when playing with ip addresses on the server, which causes cache
> reloading to fail, since it uses the "Prosody" and "Kamailio-SR" entries
> to contact the services in question to reload the caches.
>
> Andreas
>
>
>
> On 04/15/2015 05:36 PM, Dennis van der Vliet wrote:
> > The issue was not with the subscriber but with the domain. I created a
> > pull request (https://github.com/sipwise/ngcp-panel/pull/1) that fixes
> it.
> >
> > Seems to be related to the kamailio-proxy not being flushed after
> > creating a new domain.
> >
> > Dennis
> >
> > Best from Amsterdam,
> >
> > Dennis van der Vliet | Senior Engineer
> >
> > M: +31 6 53 47 44 96
> > E: dennis at messagebird.com <mailto:dennis at messagebird.com>
> > MessageBird
> > LinkedIn <https://nl.linkedin.com/in/dennisvandervliet> | Twitter
> > <https://twitter.com/dennisvdvliet>
> >
> >
> >
> > On 15 April 2015 at 17:18, Serge Yuriev <me at nevian.org
> > <mailto:me at nevian.org>> wrote:
> >
> >     Hello,
> >
> >     I also see such error but in my case user created via panel.
> >     Mr3.8.1
> >
> >     --
> >     Serge via mobile
> >
> >     Il giorno 15 апр. 2015 г., alle ore 17:12, Andrew Pogrebennyk
> >     <apogrebennyk at sipwise.com <mailto:apogrebennyk at sipwise.com>> ha
> scritto:
> >
> >>     Hi,
> >>     there is no such trigger on subscriber creation via API. Could you
> >>     please provide an example of such request (you may check
> >>     /var/log/ngcp/api.log).
> >>     What about the domains, are you using the same domain for the API
> >>     request and on the panel? This error message means that request
> >>     domain doesn't exist in the system.
> >>
> >>     Hope this helps,
> >>     Andrew
> >>
> >>     On 04/13/2015 05:53 PM, Dennis van der Vliet wrote:
> >>>
> >>>     Hi,
> >>>
> >>>     When trying to create a subscriber through the API we encounter
> >>>     the following issue. After creating the user and entering the
> >>>     credentials on a phone, registration is not possible.
> >>>
> >>>     Further inspection of the log files (kamailio-proxy.log) gives us
> >>>     the following info:
> >>>
> >>>     |Apr 13 15:43:54 voip02-ams3-do proxy[4389]: NOTICE: <script>: New
> request on proxy - M=REGISTER R=sip:sub.domain.co <http://sub.domain.co>
> F=sip:username_3217 at sub.domain.co <mailto:
> sip%3Ausername_3217 at sub.domain.co> T=sip:username_3217 at sub.domain.co
> <mailto:sip%3Ausername_3217 at sub.domain.co> IP={IP_ADDRESS} (127.0.0.1:5060
> <http://127.0.0.1:5060>) ID=b75aa40b-c9aa67f3@{IP_ADDRESS}
> >>>     Apr 13 15:43:54 voip02-ams3-do proxy[4389]: WARNING: <script>:
> Domain not served here - R=sip:sub.domain.co <http://sub.domain.co>
> ID=b75aa40b-c9aa67f3@{IP_ADDRESS}
> >>>     |
> >>>
> >>>     The issue is fixed once we restart kamailio-proxy manually.
> >>>
> >>>     Is some kind of “flush” triggered after creating a subscriber
> >>>     through the webinterface that is not triggered when you do the
> >>>     same through the API?
> >>>
> >>>     Best from Amsterdam,
> >>>
> >>>     Dennis van der Vliet | Senior Engineer
> >>>
> >>>     M: +31 6 53 47 44 96
> >>>     E: dennis at messagebird.com <mailto:dennis at messagebird.com>
> >>>     MessageBird
> >>>
> >>>     LinkedIn | Twitter
> >>>
> >>>
> >>
> >>     _______________________________________________
> >>     Spce-user mailing list
> >>     Spce-user at lists.sipwise.com <mailto:Spce-user at lists.sipwise.com>
> >>     https://lists.sipwise.com/listinfo/spce-user
> >
> >     _______________________________________________
> >     Spce-user mailing list
> >     Spce-user at lists.sipwise.com <mailto:Spce-user at lists.sipwise.com>
> >     https://lists.sipwise.com/listinfo/spce-user
> >
> >
> >
> >
> > _______________________________________________
> > Spce-user mailing list
> > Spce-user at lists.sipwise.com
> > https://lists.sipwise.com/listinfo/spce-user
> >
> _______________________________________________
> Spce-user mailing list
> Spce-user at lists.sipwise.com
> https://lists.sipwise.com/listinfo/spce-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sipwise.com/pipermail/spce-user_lists.sipwise.com/attachments/20150422/b1171ce8/attachment-0001.html>


More information about the Spce-user mailing list