originate conference from python esl - freeswitch

I want to setup a conference call, initiating from an ESL program.
In my python script I call the first number :
freeswitchcon.api("originate","sofia/gateway/MySIP/91XXXXXXXXXX+" &conference(9099)"
then I call another number:
freeswitchcon.bgapi("originate","sofia/gateway/MySIP/91XXXXXXXXXX+" &conference(radioHealth_${strftime(%Y-%m-%d)}+flags{mute})"
My Dialplans are:
<extension name="conf_demo">
<condition field="destination_number" expression="^9099$">
<action application="conference" data="radioHealth_${strftime(%Y-%m-%d)}+flags{endconf}"/>
</condition>
<extension name="conf_demo">
<condition field="destination_number" expression="^9098$">
<action application="conference" data="radioHealth_${strftime(%Y-%m-%d)}+flags{mute}"/>
</condition>
I get a call on the first number, but not on the second number. Freeswitch logs are:
2016-04-18 05:37:26.417807 [NOTICE] switch_channel.c:1055 New Channel sofia/external/91XXXXXXXXXX [a22ea00c-0527-11e6-86df-415bf8be0d99]
2016-04-18 05:37:26.777867 [NOTICE] sofia.c:7539 Hangup sofia/external/91XXXXXXXXXX [CS_CONSUME_MEDIA] [CALL_REJECTED]
2016-04-18 05:37:26.777867 [NOTICE] switch_core_session.c:1641 Session 24 (sofia/external/91XXXXXXXXXX) Ended
2016-04-18 05:37:26.777867 [NOTICE] switch_core_session.c:1645 Close Channel sofia/external/91XXXXXXXXXX [CS_DESTROY]
Any guidance would be appreciated

I realise this is a couple of years late, but I noticed that you are calling the normal api in your first originate command:
freeswitchcon.api("originate","sofia/gateway/MySIP/91XXXXXXXXXX+" &conference(9099)"
This means that the first call will be initiated but then python will wait for that call to return (i.e. when it is hung up) before continuing.
If you use freeswitchcon.bgapi, as in your second call, then the call will be originated in the background and python will not wait for the call to end before continuing.

Related

absolute_codec_string not working in dialplan

I got some trouble with using absolute_codec_string param.
My call scenario is pretty simple: caller <--> FS <--> callee.
My caller compose m=audio 7078 RTP/AVP 8 0 101 in its INVITE and I'm doing <action application="bridge" data="{absolute_codec_string=PCMU}sofia/gateway/callee/$1"/> in the dialplan.
I expected FS to use only PCMU m=audio 22952 RTP/AVP 0 101 talking to the callee
But FS still use m=audio 22952 RTP/AVP 8 0 101 in the INVITE to the callee.
Note that when I'm using originate application in fs_cli, things are good.
originate {absolute_codec_string=PCMU}sofia/gateway/caller/100 &bridge({absolute_codec_string=PCMA}sofia/gateway/callee/100
then I have FS with proper behavior in transcoding, caller has m=audio 31184 RTP/AVP 0 101 received, and callee has m=audio 21922 RTP/AVP 8 101 received.
Not sure what I'm missing, any help would be appreciated.
Edit
I was using FS media_proxy, so absolute_codec_string won't work, any another way to limit codecs used for callee to fulfill my purpose?
e.g: caller use PCMA,PCMU, I want to cut PCMA out of SDP and offer PCMU only to callee
rgds,
Loi Dang
Guess I have the answer for my own question
Briefly, I modify the whole remote sdp with variable switch_r_sdp instead of dealing with absolute_codec_string
<condition field="${switch_r_sdp}" expression="/(.*)(m=audio \d+ RTP\/AVP)([ \d]+)(.*)/s" break="never">
<action application="set" data="switch_r_sdp=$1$2$ 8 101$4"/>
<!-- Then just call bridge normally -->
</condition>
More info: https://freeswitch.org/confluence/display/FREESWITCH/Codec+Negotiation#CodecNegotiation-Modifyingthecodecwhenusingproxymediamode
rgds,
Loi Dang

WSO2 VFS FTP Proxy does not read parameters

I have written a proxy service and deployed on WSO2 ESB 5 to receive some file content via http and use vfs transport to transfer that content to an ftp server. The service works as expected when I specify the connection parameters correctly but when I specify something wrong on the connection string to simulate a down server, I can not manage to control the behavior of the VFS transport using the parameters specified in [1]. What I'm looking for is to short the delay between the error occurred in VFS and the fault exception catched by Axis;
As you are going to see below I specify 0 retries and 0 wait time between retries but it seems the VFSTransportSender class is not able to read somehow those values because it does all the time the same number of retries and it waits the same number of seconds each time it is executed, I also changed the values and put others but the result is always the same, the server is always retrying 3 more times with 30 seconds delay between each other besides the original request before Axis is able to receive some information related to the error.
Here is my proxy service that works without any issues:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="ftpProxy"
startOnLoad="true"
statistics="disable"
trace="disable"
transports="https,http">
<target>
<inSequence>
<log level="full"/>
<property expression="json-eval($.key)" name="file_name"/>
<property name="OUT_ONLY" value="true"/>
<property name="FORCE_SC_ACCEPTED" scope="axis2" value="true"/>
<property name="HTTP_SC" scope="axis2" value="200"/>
<property expression="fn:concat(get-property('file_name'), '.json')"
name="transport.vfs.ReplyFileName"
scope="transport"/>
<property name="OUT_ONLY" value="true"/>
</inSequence>
<endpoint name="ftp_endpoint">
<address uri="vfs:ftp://jairof_ftp:passftp#localhost:21">
<timeout>
<duration>2000</duration>
<responseAction>fault</responseAction>
</timeout>
<suspendOnFailure>
<errorCodes>-1</errorCodes>
<progressionFactor>1.0</progressionFactor>
</suspendOnFailure>
<markForSuspension>
<errorCodes>-1</errorCodes>
</markForSuspension>
</address>
</endpoint>
</target>
<parameter name="transport.vfs.ReconnectTimeout">0</parameter>
<parameter name="transport.vfs.MaxRetryCount">0</parameter>
<description/>
</proxy>
And when I want to simulate the server is not reachable I just modify the address URI and I put this one where the user is incorrect:
<address uri="vfs:ftp://ja8irof_ftp:passftp#localhost:21">
I have also tried to set the transport.vfs parameters as properties before calling the endpoint but the result is exactly the same
Here you can inspect part of the log file where I cut some parts of the stack trace to keep the post simple:
[2016-10-29 12:23:01,134] ERROR - VFSTransportSender cannot resolve replyFile
org.apache.commons.vfs2.FileSystemException: Could not connect to FTP server on "localhost".
... (the rest of stack trace)
...
Caused by: org.apache.commons.vfs2.FileSystemException: Could not login to FTP server on "localhost" as user "ja8irof_ftp".
at org.apache.commons.vfs2.provider.ftp.FtpClientFactory.createConnection(FtpClientFactory.java:210)
... 29 more
[2016-10-29 12:23:34,223] ERROR - VFSTransportSender cannot resolve replyFile
org.apache.commons.vfs2.FileSystemException: Could not connect to FTP server on "localhost".
... (the rest of stack trace)
...
Caused by: org.apache.commons.vfs2.FileSystemException: Could not login to FTP server on "localhost" as user "ja8irof_ftp".
at org.apache.commons.vfs2.provider.ftp.FtpClientFactory.createConnection(FtpClientFactory.java:210)
... 29 more
[2016-10-29 12:24:07,842] ERROR - VFSTransportSender cannot resolve replyFile
org.apache.commons.vfs2.FileSystemException: Could not connect to FTP server on "localhost".
... (the rest of stack trace)
...
Caused by: org.apache.commons.vfs2.FileSystemException: Could not login to FTP server on "localhost" as user "ja8irof_ftp".
at org.apache.commons.vfs2.provider.ftp.FtpClientFactory.createConnection(FtpClientFactory.java:210)
... 29 more
[2016-10-29 12:24:07,844] ERROR - VFSTransportSender cannot resolve replyFile repeatedly: Could not connect to FTP server on "localhost".
org.apache.commons.vfs2.FileSystemException: Could not connect to FTP server on "localhost".
... (the rest of stack trace)
...
Caused by: org.apache.commons.vfs2.FileSystemException: Could not login to FTP server on "localhost" as user "ja8irof_ftp".
at org.apache.commons.vfs2.provider.ftp.FtpClientFactory.createConnection(FtpClientFactory.java:210)
... 29 more
[2016-10-29 12:24:07,846] ERROR - Axis2Sender Unexpected error during sending message out
org.apache.axis2.AxisFault: cannot resolve replyFile repeatedly: Could not connect to FTP server on "localhost".
... (the rest of stack trace)
...
Caused by: org.apache.commons.vfs2.FileSystemException: Could not connect to FTP server on "localhost".
at org.apache.commons.vfs2.provider.ftp.FtpClientFactory.createConnection(FtpClientFactory.java:275)
at org.apache.commons.vfs2.provider.ftp.FTPClientWrapper.createClient(FTPClientWrapper.java:100)
at org.apache.commons.vfs2.provider.ftp.FTPClientWrapper.getFtpClient(FTPClientWrapper.java:134)
at org.apache.commons.vfs2.provider.ftp.FTPClientWrapper.<init>(FTPClientWrapper.java:59)
at org.apache.commons.vfs2.provider.ftp.FtpFileProvider.doCreateFileSystem(FtpFileProvider.java:128)
at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.getFileSystem(AbstractOriginatingFileProvider.java:155)
at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:119)
at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:88)
at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:738)
at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:626)
at org.apache.synapse.transport.vfs.VFSTransportSender.writeFile(VFSTransportSender.java:233)
... 19 more
Caused by: org.apache.commons.vfs2.FileSystemException: Could not login to FTP server on "localhost" as user "ja8irof_ftp".
at org.apache.commons.vfs2.provider.ftp.FtpClientFactory.createConnection(FtpClientFactory.java:210)
... 29 more
Please send me any comments, suggestions... I would appreciate so much, thanks in advance for your time.
[1] https://docs.wso2.com/display/ESB500/VFS+Transport
Try appending parameters to the endpoint URL, like this.
<address uri="vfs:ftp://ja8irof_ftp:passftp#localhost:21?transport.vfs.MaxRetryCount=0&transport.vfs.ReconnectTimeout=0"/>

Freeswitch converts 407 proxy authentication to 480 Temporary unavailable

Network set up like below.
End User ------- Kamailio -------- Freeswitch ----- Sip Server A
Registration in SIP Server A is success, as the request directly pass through kamailio to SIP server A, leaving freeswitch.
On receiving INVITE request from end user to Kamailio and then freeswitch and reach to SIP server A, it responds 407 proxy authentication to validate the user but in reply freeswitch sends ACK
But freeswitch replies back to kamailio as 480 temporary unavailable and call is getting dropped.
End User ------ Kamailio ----------- Freeswitch -------- SIP Server A
REGISTER -------> | ---------------------------------------------->|
| -----------> | <----------------------- 200 OK
INVITE -------------> | --------------------->| --------------------> |
|<----------- 407
(Proxy Auth Req.)
ACK ---------> |
| <--------- | <-------- 480
(Temporary Unavailable)
So here is my question ,
Reason for changing the response code in freeswitch from 407 to 480?
And how can configure freeswitch, so that it will pass the 407 response directly to kamailio , instead it convert to 480.
Need suggestions...
FreeSWITCH is not a SIP-proxy, FreeSWITCH is B2BUA. It means that FreeSWITCH trying to make independent call to SIP Server A. If it will be successful, then FreeSWITCH will bridge it with call from End User (not from kamailio, because kamailio is a SIP-proxy in this scheme, not B2BUA). It can't resend 407 to kamailio because it haven`t appropriate mechanism. But you can store authentication information in gateways on a FreeSWITCH side and instruct FreeSWITCH to make appropriate calls for each user throw dialplan.
It will work, if you write somthing like this in your external.xml SIP-profile config:
<gateway name="asterlink.com">
<param name="username" value="cluecon"/>
<param name="password" value="2007"/>
<!--/// do not register ///-->
<param name="register" value="false"/>
</gateway>
and something like this in dialplan default.xml:
<extension name="end-user">
<condition field="${sip_from_user}" expression="<end_user_caller_id_number>">
<action application="bridge" data="sofia/gateway/asterlink.com/${destination_number}"/>
</condition>
</extension>

Starting with jPOS

I have downloaded jPOS-master.zip from this link. (https://github.com/jpos/jPOS ).
Ran the command gradle clean dist installApp
Found jPOS-master\jpos\build\install\jpos\jpos-1.9.5-SNAPSHOT.jar
Ran the command java -jar jpos-1.9.5-SNAPSHOT.jar
Got the below console:
<log realm="Q2.system" at="Mon Dec 30 14:47:08 IST 2013.183" lifespan="10ms">
<info>
Q2 started, deployDir=D:\jPOS-master\jPOS-master\jpos\build\install\jpos\deploy
jPOS 1.9.5-SNAPSHOT unknown/unknown (2013-12-30 14:44:39 IST)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
jPOS Community Edition, licensed under GNU AGPL v3.0.
This software is probably not suitable for commercial use.
Please see http://jpos.org/license for details.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Darwin)
iQEcBAEBAgAGBQJMolHDAAoJEOQyeO71nYtFv74H/3OgehDGEy1VXp2U3/GcAobg
HH2eZjPUz53r38ARPiU3pzm9LwDa3WZgJJaa/b9VrJwKvbPwe9+0kY3gScDE1skT
ladHt+KHHmGQArEutkzHlpZa73RbroFEIa1qmN6MaDEHGoxZqDh0Sv2cpvOaVYGO
St8ZaddLBPC17bSjAPWo9sWbvL7FgPFOHhnPmbeux8SLtnfWxXWsgo5hLBanKmO1
1z+I/w/6DL6ZYZU6bAJUk+eyVVImJqw0x3IEElI07Nh9MC6BA4iJ77ejobj8HI2r
q9ulRPEqH9NR79619lNKVUkE206dVlXo7xHmJS1QZy5v/GT66xBxyDVfTduPFXk=
=oP+v
-----END PGP SIGNATURE-----
</info>
</log>
<log realm="Q2.system" at="Mon Dec 30 14:47:08 IST 2013.200" lifespan="8ms">
<info>
deploy: D:\jPOS-master\jPOS-master\jpos\build\install\jpos\deploy\99_sysmon.xml
</info>
</log>
<log realm="org.jpos.q2.qbean.SystemMonitor" at="Mon Dec 30 14:47:08 IST 2013.202">
<info>
Starting SystemMonitor
</info>
</log>
<log realm="org.jpos.q2.qbean.SystemMonitor" at="Mon Dec 30 14:47:08 IST 2013.203">
<info>
OS: Windows 7
host: *****/*******
version: 1.9.5-SNAPSHOT (unknown)
instance: a0032410-aff4-4128-9bf1-1d14966f2ea9
uptime: 00:00:00.280
processors: 4
drift : 0
memory(t/u/f): 121/8/113
threads: 4
Thread[Reference Handler,10,system]
Thread[Finalizer,8,system]
Thread[Signal Dispatcher,9,system]
Thread[Attach Listener,5,system]
Thread[Q2-a0032410-aff4-4128-9bf1-1d14966f2ea9,5,main]
Thread[DestroyJavaVM,5,main]
Thread[Timer-0,5,main]
Thread[SystemMonitor,5,main]
name-registrar:
logger.Q2.buffered: org.jpos.util.BufferedLogListener
logger.Q2: org.jpos.util.Logger
</info>
</log>
When I do a telnet to localhost i get below exception .. which means that Q2 Server is not up.
Connecting To 127.0.0.1...Could not open connection to the host, on port 10000: Connect failed
When I do a gradle test I get the below exception
org.jpos.iso.packagers.PackagerTestCase > testXMLPackager FAILED
junit.framework.AssertionFailedError at PackagerTestCase.java:214
org.jpos.util.DailyLogListenerTest > testLogRotationAndCompressionWorks FAILED
java.lang.AssertionError at DailyLogListenerTest.java:303
> Building > :jpos:test > 3145 tests completed, 2 failed, 54 skipped
Can somebody please help as how to bring up the Q2 Server ? I have read proguide-draft.pdf, but could not understand what is the issue. I want to get a server up and running and hit it with some sample requests and get the responses back.
Do I need put some more xmls in deploy directory for Server deployment ? Also after running gradle installApp I could not find any q2.bat in the install directory, I Could find only ..
bsh q2 start stop files.
Thanks in advance,
Varun Kumar A.
Can somebody please help as how to bring up the Q2 Server ? I have
read proguide-draft.pdf, but could not understand what is the issue. I
want to get a server up and running and hit it with some sample
requests and get the responses back.
You can use "jpos-template" for server and client simulation. Detail how to is here in these beautiful blog posts. As per the ducumentation,
[Implementing a jpos dateway] page no 8
We connect here to jPOS' auto-responder, which is usually up and
listening on port 9000. You could use a local server, for example
based on jPOS-EE's server simulator.
You can use server simulator as a auto responder (remote host as per diagram) to prepare a demo environment of jpos.
Sever Simulator
Client Simulator
Your serve is not deployed properly, you need to add serversimulator.bsh and serversimulator.xml to corresponding folders and then try again.

XmlRpcException during TeamCity build agent registration

I have installed the TeamCity build agent on my machine a few different ways- using Java Web Start and the manual .zip distribution. Both result in viable installations, as I have once or twice been able to connect and register properly with the TeamCity server. However, upon restarting (<install_location>/bin/agent.sh stop...<install_location>/bin/agent.sh start) I get the following error in teamcity-agent.log (with extra debugging turned on in the log4j config file).
[2013-04-03 09:05:09,870] DEBUG - jetbrains.buildServer.XMLRPC - faultStringjava.lang.RuntimeException: org.jdom.input.JDOMParseException: Error on line 28: XML document structures must start and end within the same entity.faultCode0
[2013-04-03 09:05:09,878] DEBUG - buildServer.AGENT.registration - jetbrains.buildServer.xmlrpc.RemoteCallException: Call http://teamcityserver:8080/RPC2 buildServer.registerAgent3: org.apache.xmlrpc.XmlRpcException: java.lang.RuntimeException: org.jdom.input.JDOMParseException: Error on line 28: XML document structures must start and end within the same entity.
jetbrains.buildServer.xmlrpc.RemoteCallException: Call http://teamcityserver:8080/RPC2 buildServer.registerAgent3: org.apache.xmlrpc.XmlRpcException: java.lang.RuntimeException: org.jdom.input.JDOMParseException: Error on line 28: XML document structures must start and end within the same entity.
at jetbrains.buildServer.xmlrpc.AbstractXmlRpcTarget.call(AbstractXmlRpcTarget.java:94)
at jetbrains.buildServer.agent.impl.ServerXmlRpcProxy.registerAgent3(ServerXmlRpcProxy.java:62)
at jetbrains.buildServer.agent.impl.BuildAgentImpl.doRegisterOnBuildServer(BuildAgentImpl.java:776)
at jetbrains.buildServer.agent.impl.BuildAgentImpl.registerOnBuildServer(BuildAgentImpl.java:748)
at jetbrains.buildServer.agent.impl.ServerMonitor.run(ServerMonitor.java:71)
Caused by: org.apache.xmlrpc.XmlRpcException: java.lang.RuntimeException: org.jdom.input.JDOMParseException: Error on line 28: XML document structures must start and end within the same entity.
at org.apache.xmlrpc.XmlRpcClientResponseProcessor.decodeException(XmlRpcClientResponseProcessor.java:104)
at org.apache.xmlrpc.XmlRpcClientResponseProcessor.decodeResponse(XmlRpcClientResponseProcessor.java:71)
at org.apache.xmlrpc.XmlRpcClientWorker.execute(XmlRpcClientWorker.java:73)
at org.apache.xmlrpc.TCXmlRpcClient$1.execute(TCXmlRpcClient.java:89)
at org.apache.xmlrpc.XmlRpcClient.execute(XmlRpcClient.java:194)
at org.apache.xmlrpc.XmlRpcClient.execute(XmlRpcClient.java:185)
at org.apache.xmlrpc.XmlRpcClient.execute(XmlRpcClient.java:178)
at jetbrains.buildServer.xmlrpc.impl.CommonsXmlRpcTargetImpl$1.execute(CommonsXmlRpcTargetImpl.java:72)
at jetbrains.buildServer.xmlrpc.AbstractXmlRpcTarget.call(AbstractXmlRpcTarget.java:84)
... 4 more
[2013-04-03 09:05:09,878] WARN - buildServer.AGENT.registration - Call http://teamcityserver:8080/RPC2 buildServer.registerAgent3: org.apache.xmlrpc.XmlRpcException: java.lang.RuntimeException: org.jdom.input.JDOMParseException: Error on line 28: XML document structures must start and end within the same entity.
[2013-04-03 09:05:09,878] WARN - buildServer.AGENT.registration - Connection to TeamCity server is probably lost. Will be trying to restore it. Take a look at logs/teamcity-agent.log for details (unless you're using custom logging).
This is the xml in question according to the logs with extra xmlrpc debugging:
<?xml version="1.0"?><methodCall><methodName>buildServer.registerAgent3</methodName><params><param><value><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<agentDetails agentName="aaronhbox_0" agentPort="9090" authToken="" osName="Linux, version 3.5.0-17-generic">
<alternativeAddresses>
<address>10.2.1.232</address>
<address>192.168.225.1</address>
<address>192.168.80.1</address>
</alternativeAddresses>
<availableRunners>
<runner runType="Ant" />
<runner runType="Duplicator" />
<runner runType="gradle-runner" />
<runner runType="Inspection" />
<runner runType="Ipr" />
<runner runType="JPS" />
<runner runType="Maven2" />
<runner runType="rake-runner" />
<runner runType="simpleRunner" />
</availableRunners>
<availableVcs>
<vcs name="perforce" />
<vcs name="mercurial" />
<vcs name="jetbrains.git" />
<vcs name="svn" />
<vcs name="cvs" />
</availableVcs>
<buildParameters>
<param name="env.COLORTERM" value="gnome-terminal" />
<param name="env.COMP_WORDBREAKS"><![CDATA["'><;|]]></value></param></params></methodCall>
Only once have I been able to restart the agent and have it connect again properly. Generally, I can install it, have it run once, then restarting it gives this error. Any ideas?
It looks like the formatting of the COMP_WORDBREAKS environment variable was messing with the xml structure and not allowing the complete generation of the xml request message.
The COMP_WORDBREAKS value on my machine is "'><;|&(:.
Placing the following line in the buildAgent.properties file fixed this problem and allows the agent to properly register.
env.COMP_WORDBREAKS=
I don't see any side-effects yet of making this change; the agent now seems to behave properly.

Resources