[Spce-user] Creating subscribers through the API

Gerhard Jungwirth gjungwirth at sipwise.com
Thu Apr 16 11:27:17 EDT 2015


Hi,

On 04/16/2015 10:27 AM, Dennis van der Vliet wrote:
> Hi Andrew,
>
> +----+-----------+------+-------+----------+--------------+
> | id | ip        | port | path  | sip_port | description  |
> +----+-----------+------+-------+----------+--------------+
> |  1 | 127.0.0.1 | 8000 | /RPC2 |     5062 | Kamailio     |
> |  2 | 127.0.0.1 | 8090 | /     |     NULL | Sems         |
> |  3 | 127.0.0.1 | 5062 | /     |     NULL | Kamailio-SR  |
> |  4 | 127.0.0.1 | 5060 | /     |     NULL | Loadbalancer |
> |  5 | 127.0.0.1 | 5582 | /     |     NULL | Prosody      |
> +----+-----------+------+-------+----------+--------------+
This actually looks good.
>
> I tested a couple of things:
>
> 1. Trigger the xml request manually after creating a domain from the
> API -> this works
> 2. Altering the codes as in the pull request
> (https://github.com/sipwise/ngcp-panel/pull/1 ) -> this works

I think, now that you have all services up and running, domain creation
should also work in API and Webinterface without any patches.

>
> Also if you look how a domain is created through the webinterface
> (https://github.com/sipwise/ngcp-panel/blob/master/lib/NGCP/Panel/Controller/Domain.pm#L99-L147)
> I think we see that domain is created and committed to the database
> (line 100-137) and after that the xml request is triggered (line 147)
>
> If you take a look at how it is done in the API this looks different
> (https://github.com/sipwise/ngcp-panel/blob/master/lib/NGCP/Panel/Controller/API/Domains.pm#L156-L226).
> In this case the transaction is only committed (line 226) after the
> xml request is made (line 212).

This might look a bit misleading, but actually both parts behave in the
same way. The scope guard initialized by

    my $guard = $c->model('DB')->txn_scope_guard;

creates a transaction, which is only committed after an explicit call of
commit. The transaction wrapper in the webinterface code does the same
thing, it just commits the whole transaction after the block has
successfully exited:

    $c->model('DB')->schema->txn_do( sub { ... } );

>
> So that is why I proposed the changes in the pull request
> (https://github.com/sipwise/ngcp-panel/pull/1)

Thanks anyway for your input. We will try to unify those ways in the future.

Gerhard


>
> 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 16 April 2015 at 09:53, Andrew Pogrebennyk
> <apogrebennyk at sipwise.com <mailto:apogrebennyk at sipwise.com>> wrote:
>
>     Hi Dennis,
>     what do you have in your provisioning.xmlhosts table?
>
>     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
>>
>>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sipwise.com/pipermail/spce-user_lists.sipwise.com/attachments/20150416/4870ea37/attachment-0001.html>


More information about the Spce-user mailing list