Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change in fsw regex #7

Open
alzrck opened this issue Jun 21, 2022 · 0 comments
Open

change in fsw regex #7

alzrck opened this issue Jun 21, 2022 · 0 comments

Comments

@alzrck
Copy link

alzrck commented Jun 21, 2022

Hi, just wanted to mention the following.

default freeswitch (meaning with default when it's recently installed with basic config) output for 'sofia status' is

`
freeswitch@itfspre> sofia status
Name Type Data State

        external-ipv6	profile	                  sip:mod_sofia@[::1]:5080	RUNNING (0)
             external	profile	            sip:[email protected]:5080	RUNNING (0)
external::example.com	gateway	                   sip:[email protected]	NOREG

=================================================================================================
2 profiles 0 aliases

`

but, many other configs can occur regarding profiles, for example, i do have a box that is a gateway to other 2 sbcs where sofia status shows

`
CCLAB > sofia status
Name Type Data State

                  wan	profile	           sip:[email protected]:5060	RUNNING (0)
             wan::ims	gateway	                 sip:[email protected]:5060	NOREG
            wan::gwcc	gateway	               sip:[email protected]:11000	NOREG
           wan::cs2k1	gateway	              sip:[email protected]:15060	NOREG

=================================================================================================
1 profile 0 aliases

`

So, default regex in fsw.js matched the wrong IP (was announcing to the drachtio server the IP of one of the gateways and not the IP of the local profile itself).

So i made a small change to the regex to match it

current one is

var re = new RegExp('^\\s*' + self.profile + '\\s.*sip:[^"]+@((?:[0-9]{1,3}\\.){3}[0-9]{1,3}):(\\d+)', 'm') ;

modified one is

var re = new RegExp('^\\s+' + self.profile + '\\tprofile\\t\\s+sip:[^"]+@((?:[0-9]{1,3}\\.){3}[0-9]{1,3}):(\\d+)\\tRUNNING.+$', 'm') ;

tested with both sofia status outputs and works ok.

Best regards and thanks for your work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant