Re: [OpenSIPS-Users] Unable to parse JSON

2019-07-30 Thread Liviu Chircu

On 30.07.2019 10:40, Hamid Hashmi wrote:


it gives me a NULL Value. What am I doing wrong?


Sounds like you're using the "=" assignment operator instead of the ":=" 
one,

which is the proper way of telling the module to parse a JSON input string.

So, for example, you'd do:

$json(response) := $var(rest_client_result);

Cheers,

--
Liviu Chircu
OpenSIPS Developer
http://www.opensips-solutions.com

___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] mhomed=1 and force_send_socket()

2019-07-30 Thread Johan De Clercq
mhomed =1 will make sure that the outgoing interface towards user A is the
interface on which user A has registered.
Hence you need to be very very careful with mhomed=1.
I use force_send_socket when I a have a mixed environment (e.g users that
register, connection to provider without registration, etc).

these are my 2 drops of wisdom :-)

as for BIN, that I can't explain as I never used that type of interface.

.
Op di 30 jul. 2019 om 17:16 schreef Vitalii Aleksandrov <
vitalik.v...@gmail.com>:

> Hi,
>
> Have a problem with a multihomed proxy which doesn't select outgoing
> interface correctly. Found similar topics where people discussed usage
> of force_send_socket() when they want to force opensips to use some
> interface.
>
> As far as I understood "mhomed=1" is the option which forces opensips to
> select a proper outgoing interface in multihomed environment. This
> options really works, but unfortunately only for UDP. When opensips has
> multiple TCP / TLS / BIN interfaces, opensips just takes the first from
> the list which is not always correct and fails to establish an outgoing
> connection.
>
> Since I have a module that detects an outgoing interface I can use this
> info with $fs to force correct socket for SIP. Unfortunately this trick
> doesn't work for BIN and it's not possible to setup a multihomed
> opensips with clustering neighbors in both internal and external networks.
>
> Is there any workaround for BIN?
>
>
> ___
> Users mailing list
> Users@lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


[OpenSIPS-Users] mhomed=1 and force_send_socket()

2019-07-30 Thread Vitalii Aleksandrov

Hi,

Have a problem with a multihomed proxy which doesn't select outgoing 
interface correctly. Found similar topics where people discussed usage 
of force_send_socket() when they want to force opensips to use some 
interface.


As far as I understood "mhomed=1" is the option which forces opensips to 
select a proper outgoing interface in multihomed environment. This 
options really works, but unfortunately only for UDP. When opensips has 
multiple TCP / TLS / BIN interfaces, opensips just takes the first from 
the list which is not always correct and fails to establish an outgoing 
connection.


Since I have a module that detects an outgoing interface I can use this 
info with $fs to force correct socket for SIP. Unfortunately this trick 
doesn't work for BIN and it's not possible to setup a multihomed 
opensips with clustering neighbors in both internal and external networks.


Is there any workaround for BIN?


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] need some help using opensips 3.0 cluster module .

2019-07-30 Thread Liviu Chircu
Do you get any errors in the logs?  Can you connect from console with 
that user/password, just
to confirm access works?  It looks like a configuration issue. If you 
can't figure it out,

please provide full debug logs.

Liviu Chircu
OpenSIPS Developer
http://www.opensips-solutions.com

On 30.07.2019 14:49, Sasmita Panda wrote:
This is the common configuration for every node . But why its 
deviating for node 1 to save the data in local mysql location DB . 


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] need some help using opensips 3.0 cluster module .

2019-07-30 Thread Sasmita Panda
Ok  . Thats great . I got it .

In this case something strange happening with me . The node1 in the
cluster, in which I am running mongodb also (which is accessible for all 3
nodes in the cluster  ) never write any data in the local mysql .
Configuration for all the nodes are same . Other 2 nodes are writing but
node 1 is not writing .

modparam("usrloc", "db_url",
"mysql://root:cccl0g1c@localhost/opensips")
modparam("usrloc", "use_domain", 1)
modparam("usrloc", "location_cluster", 1)
modparam("usrloc", "cluster_mode", "federation-cachedb")
modparam("usrloc", "restart_persistency", "load_from_sql")
modparam("usrloc", "sql_write_mode", "write-back")

This is the common configuration for every node . But why its deviating for
node 1 to save the data in local mysql location DB .

*Thanks & Regards*
*Sasmita Panda*
*Senior Network Testing and Software Engineer*
*3CLogic , ph:07827611765*


On Tue, Jul 30, 2019 at 1:37 PM Liviu Chircu  wrote:

> The federated clustering actually scales very well horizontally:  as
> your subscriber
> base grows, you add more active/backup pairs into the mix, further
> partitioning them.
>
> The tutorial teaches you how to add HA for a platform with 2 locations
> and 4 nodes.  If you need to add MySQL persistency, change:
>
> modparam("usrloc", "working_mode_preset", "federation-cachedb-cluster")
>
> ... into:
>
> modparam("usrloc", "cluster_mode", "federation-cachedb")
> modparam("usrloc", "restart_persistency", "load-from-sql")
> modparam("usrloc", "sql_write_mode", "write-back")
>
> PS: please forget about "db_mode".  It is deprecated, 100% replaced by
> "working_mode_preset"
> in 2.4+, and cannot possibly add any further value, regardless of your
> usrloc needs.
>
> Best regards,
>
> Liviu Chircu
> OpenSIPS Developer
> http://www.opensips-solutions.com
>
> On 30.07.2019 10:15, Sasmita Panda wrote:
> > When the db_mode is set , then I cant set working_mode_preset . So
> > there is no clustering and horizontal scaling . Right ?
>
> ___
> Users mailing list
> Users@lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] need some help using opensips 3.0 cluster module .

2019-07-30 Thread Liviu Chircu
The federated clustering actually scales very well horizontally:  as 
your subscriber
base grows, you add more active/backup pairs into the mix, further 
partitioning them.


The tutorial teaches you how to add HA for a platform with 2 locations
and 4 nodes.  If you need to add MySQL persistency, change:

modparam("usrloc", "working_mode_preset", "federation-cachedb-cluster")

... into:

modparam("usrloc", "cluster_mode", "federation-cachedb")
modparam("usrloc", "restart_persistency", "load-from-sql")
modparam("usrloc", "sql_write_mode", "write-back")

PS: please forget about "db_mode".  It is deprecated, 100% replaced by 
"working_mode_preset"
in 2.4+, and cannot possibly add any further value, regardless of your 
usrloc needs.


Best regards,

Liviu Chircu
OpenSIPS Developer
http://www.opensips-solutions.com

On 30.07.2019 10:15, Sasmita Panda wrote:
When the db_mode is set , then I cant set working_mode_preset . So 
there is no clustering and horizontal scaling . Right ?


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


[OpenSIPS-Users] Unable to parse JSON

2019-07-30 Thread Hamid Hashmi
Below is the JSON response received in an async rest post request (mod 
rest_client).

 xlog("L_INFO","[$fU $tU $ci $rm] PUSH Server responded with 
$var(rcode):$json(response)");

{
  "error": null,
  "payload": {
"results": [
  {
"error": {
  "code": "messaging/registration-token-not-registered",
  "message": "The provided registration token is not registered. A 
previously valid registration token can be unregistered for a variety of 
reasons. See the error documentation for more details. Remove this registration 
token and stop using it to send messages."
}
  }
],
"canonicalRegistrationTokenCount": 0,
"failureCount": 1,
"successCount": 0,
"multicastId": 4814925980047675000
  }
}

But when I try to print the following line

xlog("L_INFO","[$fU $tU $ci $rm] PUSH Server responded with $var(rcode) with 
Failure Count: $json(response/payload/failureCount)");

it gives me a NULL Value. What am I doing wrong?

version: opensips 2.4.6 (x86_64/linux)
flags: STATS: On, DISABLE_NAGLE, USE_MCAST, SHM_MMAP, PKG_MALLOC, F_MALLOC, 
FAST_LOCK-ADAPTIVE_WAIT
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, 
MAX_URI_SIZE 1024, BUF_SIZE 65535
poll method support: poll, epoll, sigio_rt, select.
git revision: edef893c5
main.c compiled on 11:29:33 Jul 29 2019 with gcc 4.8.5

[root@sip-3 opc]# rpm -qa | grep json
json-c-devel-0.11-4.el7_0.x86_64
libfastjson-0.99.4-3.el7.x86_64
python-jsonpatch-1.2-4.el7.noarch
json-c-0.11-4.el7_0.x86_64
json-glib-devel-1.4.2-2.el7.x86_64
python-jsonpointer-1.9-2.el7.noarch
json-glib-1.4.2-2.el7.x86_64


Regards


Hamid R. Hashmi
___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] need some help using opensips 3.0 cluster module .

2019-07-30 Thread Sasmita Panda
When you are saying to keep the data in local mysql , that means , I cant
run clustering .
When the db_mode is set , then I cant set working_mode_preset . So there is
no clustering and horizontal scaling . Right ?


*Thanks & Regards*
*Sasmita Panda*
*Senior Network Testing and Software Engineer*
*3CLogic , ph:07827611765*


On Tue, Jul 30, 2019 at 12:35 PM Liviu Chircu  wrote:

> On 30.07.2019 09:57, Sasmita Panda wrote:
> > When we say "restart_persistency : sync_from_cluster" . How this will
> > work with federated clustering ?
>
> That is meant to work with active/backup pairs, which are federated into
> a global cluster.
> For example:
>
> location A with nodes: A1 (active), A2 (backup)
> location B with nodes: B1 (active), B2 (backup)
>
> Both A1 and A2 can restart and sync from each other, without even
> needing a MySQL.
> Same goes for B1 and B2.  Of course, if you lose a node and you restart
> the other
> one, you cannot sync: so you might want to keep that local MySQL instance
> :)
>
> Regards,
>
> --
> Liviu Chircu
> OpenSIPS Developer
> http://www.opensips-solutions.com
>
>
> ___
> Users mailing list
> Users@lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] need some help using opensips 3.0 cluster module .

2019-07-30 Thread Liviu Chircu

On 30.07.2019 09:57, Sasmita Panda wrote:
When we say "restart_persistency : sync_from_cluster" . How this will 
work with federated clustering ?


That is meant to work with active/backup pairs, which are federated into 
a global cluster.

For example:

location A with nodes: A1 (active), A2 (backup)
location B with nodes: B1 (active), B2 (backup)

Both A1 and A2 can restart and sync from each other, without even 
needing a MySQL.
Same goes for B1 and B2.  Of course, if you lose a node and you restart 
the other

one, you cannot sync: so you might want to keep that local MySQL instance :)

Regards,

--
Liviu Chircu
OpenSIPS Developer
http://www.opensips-solutions.com


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] need some help using opensips 3.0 cluster module .

2019-07-30 Thread Sasmita Panda
I will provide full DEBUG logs for dialing "sip3" . Before that I have a
query . May be its silly .

When we are saying federated clustering , it means every node has their own
data in the memory and the meta data in the cache db .
So when call comes to 1 node then it routes the call to the appropriate
node through which the number get registered seeing the metadata from the
cacheDB .   Till now this is understood .

When we say "restart_persistency : sync_from_cluster" . How this will work
with federated clustering ?

 If I am not wrong , then to achieve this I have to run the cluster with HA
.  As for my understanding without HA , restart_persistency is not possible
in federated clustering . Do let me know if I am wrong .

Rest of the two model "full_charing" and "full_sharing_cachedb"
restart_persistency is achieved as in earlier case the memory of each node
is synced with each other and in the latter case the data in common cacheDB
.

*Thanks & Regards*
*Sasmita Panda*
*Senior Network Testing and Software Engineer*
*3CLogic , ph:07827611765*


On Mon, Jul 29, 2019 at 4:30 PM Liviu Chircu  wrote:

> Can you provide full DEBUG level logs on the server while you are dialing
> "sip3"?  Thanks!
>
> Liviu Chircu
> OpenSIPS Developerhttp://www.opensips-solutions.com
>
> On 29.07.2019 13:01, Sasmita Panda wrote:
>
> Thank you Liviu ,
>
> I got your explanation .  fullsharing and fullsharing_cachedb , these two
> works when there is no NAT between the user and opensips node .  This is
> clear now .
>
> I am facing another problem . May be I am doing any silly mistake .
>
> > db.userlocation.find({ "_id" : "s...@opensips-local.com"})
> { "_id" : "s...@opensips-local.com", "aorhash" : 101148538, "contacts" :
> { "c2lwOnNpcDNAMTk" : { "attr" : null, "sip_instance" : null, "methods" :
> 5888, "sock" : "udp:192.168.0.1:5508", "path" : null, "received" : null,
> "cflags" : "", "last_mod" : NumberLong(1564393280), "ua" : "WebAstra",
> "flags" : 0, "cseq" : 34914, "callid" : "ad275697703", "q" : 100, "expires"
> : 1564393580, "contact" : "sip:sip3@192.168.0.x:56401"
>  } } }
>
> > db.userlocation.find({ "_id" : "5...@opensips-local.com"})
> { "_id" : "5...@opensips-local.com", "aorhash" : 1015579193, "contacts" :
> { "c2lwOjU2NTZAMT" : { "attr" : null, "sip_instance" : null, "methods" :
> 8063, "sock" : "udp:192.168.0.2:5508", "path" : null, "received" : null,
> "cflags" : "", "last_mod" : NumberLong(1564392892), "ua" :
> "MicroSIP/3.15.10", "flags" : 0, "cseq" : 29098, "callid" :
> "5355813986f94a2", "q" : -1, "expires" : 1564393192, "contact" :
> "sip:5656@192.168.0.x:49396;ob"  } } }
>
> I have 2 user sip3 , 5656  . The contact exists in the cachedb also . But
> when I am dialing 5656 (configure in a softphone )call goes to that user .
> But when I am dialing sip3 (username of 1 agent)  then opensips gives "404
> Not Found" .
> Why so ? Both the contact in the cache looks similar . Still why call wont
> go to sip3 .  In other mode of clustering also this thing happens . What
> mistake  am I doing ?
>
>
>
> *Thanks & Regards*
> *Sasmita Panda*
> *Senior Network Testing and Software Engineer*
> *3CLogic , ph:07827611765*
>
>
> On Thu, Jul 25, 2019 at 4:03 PM Liviu Chircu  wrote:
>
>> Hi Sasmita,
>>
>> As I have written with bold font in the docs of each cluster parameter:
>>
>> *This parameter will get overridden if either working_mode_preset
>> 
>>  or db_mode
>>  is
>> set.*
>>
>> If you want some low-level configuration for your usrloc cluster (and not
>> the defaults),
>> do not set the "working_mode_preset".  It's job is to make it easy to get
>> everything
>> working.
>>
>> Regarding 2): the default of "full-sharing-cluster" is to sync from
>> cluster.  That's why
>> you get no data in MySQL.  Just remove "working_mode_preset", and change
>> the persistency
>> to "sync-from-sql", so it starts writing the data over there.
>>
>> An architecture comment regarding 2): you are doing full sharing (any
>> node should be able
>> to take over any contact), so make sure your network topology supports
>> this.  A
>> front-end SIP entity that's balancing traffic to this cluster + SIP path
>> headers is needed
>> here before it can logically work, otherwise you'll run into NAT issues
>> (only the home server
>> will be able to route back to the phone, rather than any node which has
>> the data)
>>
>> Regarding 3): same architectural issue as in 2).  You are attempting to
>> builkd a homogeneous cluster,
>> yet this is not true, because of all sort of NAT limitations, restraining
>> traffic to be only
>> sent from a certain node at a time.
>>
>> Conclusion:  we didn't make these multiple modes just for fun, each of
>> them serves its purpose :)
>> And I agree that for your current needs, it seems like the "federated"
>> clustering is the way to go.
>>
>> Best regards,
>>