From Freeswitch CHANNEL_HANGUP events determine which part has disconnected a call - freeswitch

Is it possible from FreeSWITCH CHANNEL_HANGUP event (or others) determine who has disconnected a call?

I have resolved this by inspecting the following SIP header - 'sip_hangup_disposition'
Link to the corresponding documentation https://freeswitch.org/confluence/display/FREESWITCH/sip_hangup_disposition

Related

How to get notification for new available Wifi Network

Is there a way to get a notification when a new Wifi Network has been detected?
I glanced through the Native Wifi API Reference and found the WlanRegisterNotification function but I'm not sure if that includes what i am looking for. The remark does not mention it.
Yes, WlanRegisterNotification is indeed the correct function. You need to do a little digging in the documentation to find exactly what each notification provides, by looking at WLAN_NOTIFICATION_DATA (in the remarks section for WlanRegisterNotification), then WLAN_NOTIFICATION_ACM†. Specifically, you're looking for one of these two notifications:
wlan_notification_acm_network_available Which gives a notification when a connectable network is detected, and you're not currently connected to another network, and there isn't an automatic connection available.
wlan_notification_acm_scan_list_refresh (Windows 8+)
† ACM stands for "auto configuration module"

How to set SO_REUSEADDR option in zmq::setsockopt() -- if possible, or any workaround?

I am trying to implement an app/thread that listens to an ipaddr:port on which another app/thread is already listening. I know I need to update both the apps to set SO_REUSEADDR in setsockopt(...) before bind() to avoid "Address Already in use" error when the 2nd app tries to bind().
The problem is that these apps(libs) are in an existing system that uses ZeroMQ on it's own. I cannot use linux socket lib directly. I have to use ZeroMQ sockets only.
Apparently zmq::setsockopt() does not understand SO_REUSEADDR as an option as its not defined in the zmq.h header. At least there is no ZMQ_SO_REUSEADDR
Or may be I am not using the right option.
Can someone help me with this issue. Does ZMQ socket support SO_REUSEADDR or not support at all, in which case how to go about this issue?
There's a couple things going on here.
SO_REUSEADDR is not going to help you. [see here].
SO_REUSEADDR will not allow you to share the same socket signature between two applications. So, if you are bound to a specific address:port in your first application and still using that address and port in that application, then you will not be able to bind to it in your second application. SO_REUSEADDR allows you to grab an address:port signature for a new application once an old application has given it up but it's still lingering, waiting for the buffer to clear.
SO_REUSEPORT is what you're looking for [see same link as above].
SO_REUSEPORT is intended to allow multiple applications to share the same address signature. This seems to be what you're looking for.
SO_REUSEPORT is not supported in ZMQ [see here].
You cannot bind to the same address:port in multiple applications on the same host in ZMQ. It's not supported as of June of last year.
... if you wish to just handle the case where another service is spinning down and a new service wishes to bind on the same address:port signature, you'll have to set ZMQ_LINGER to 0 on the original connection so that it won't hold the socket to clear the buffer.

how to originate two applications from fs_cli

Please answer this interesting question, I want to make two applications communicate with each other in free switch without a sip user, I have tried following things on fs_cli
originate user/1001 &bridge(Sofia/internal/1789)
user is able to communicate with the application
originate Sofia/internal/1235 &bridge(Sofia/internal/1789)
but this is throwing error that "cannot blind transfer 1235";
I noticed that by default a sip call is originated with caller id:<00000000> and transferring call to sip user in first case but unable to transfer to dial plan in second case please help me
Loopback is for you, create an extension / dialplan with one application and reload the dialplan, and then at fs_cli you can use loopback in originate to dial that application and at the other end enter second application, that's all
https://wiki.freeswitch.org/wiki/Loopback_endpoint

How can I call an internal sip phone using a server with freeswitch

I want to make an internal call from a server with freeswitch to a sip phone that's registered and connected and has the extension of 1000
I'm fairly sure I use originate sofia and I've been trying several combinations with no result.
The sort of thing I've been trying is
originate sofia/internal/1000#[my IP address] &park{}
And I get the result
-ERR NO_USER_RESPONSE
I'm currently outside of my lab, but I believe you can use "user/1000" as the first destination. Also "sofia/internal/1000" should probably work.

How Free Switch Profiles and Bridges work

What is the meaning of internal profile or external profile in Free Switch?
Also I don't know the meaning of -
application="bridge".
I also cannot understand
data="${sofia_contact($${gwuser}#$${domain})}"
or
data="sofia/internal/${destnumber}#192.168.10.33:5062"
It will be really helpful if someone could give me a proper explanation, or at least, point me to a right direction.
"internal" and "external" are names of sip profiles. Those are usually defined in the default configuration of freeswitch. They are sample configurations optimized for internal or external access, you can define other sip profiles with a configuration according to your needs.
application="bridge" is an application that bridges an incoming call to an other external or internal destination.
data="sofia/internal/${destnumber}#192.168.10.33:5062" means you want to use the sofia sipstack, the sip profile with the name "internal" with the content of the variable "destnumber" to ip 192.168.10.3 on port 5062.
Application bridge connects two channels(end-points) together.
sofia_* is the open source SIP protocol implementation developed by Nokia guys.
So, $${gwuser} is variable which contains the name of the user to call in SIP address notation: name#domain.
${domain} is the domain name.
sofia/internal/<adress> means that will be used internal sip number which is handled by local freeswitch PBX.
I think you should clarify a bit how freeswitch (mod_sofia) consider locally registered endpoints vs gateways:
http://wiki.freeswitch.org/wiki/Mod_sofia

Resources