Freeswitch API command problems - freeswitch

I have two problems with Freeswitch v 1.6 API https://freeswitch.org/confluence/display/FREESWITCH/mod_conference#mod_conference-APIReference:
1) vid-mute-img command called as "/webapi/conference?957 vid-mute-img all /var/lib/freeswitch/images/myprepa-mute.png" and file placed to the correct location, but result always the same "/var/lib/freeswitch/images/default-mute.png" and default image is used.
2) vid-banner command called as "/webapi/conference?957 vid-banner all BannerText", but result always the same "Channel %s is not in a video layer"
What am I doing wrong?
Thanks in advance!

Related

Is there any way to batch export TLS States with additional files?

From https://sumo.dlr.de/docs/Simulation/Output/Traffic_Lights.html#tls_states , I know that I can use command <timedEvent type="SaveTLSStates" source="<TLS_ID>" dest="<OUTPUT_FILE>"/> in additional file to output the state of the traffic light, whose ID is "TLS_ID" defined in .net.xml file. However I wonder that if I use this way to output the TLS, do I have to enter this command for each ID of the traffic light? Is there a statement that can output the state of all traffic light defined in .net.xml?
No, but you can write a small python script to achieve that:
import sumolib
net = sumolib.net.readNet("net.net.xml")
states_xml = sumolib.xml.create_document("additional")
for tls in net.getTrafficLights():
event = states_xml.addChild("timedEvent")
event.setAttribute("type", "SaveTLSStates")
event.setAttribute("source", tls.getID())
event.setAttribute("dest", "states.xml")
with open("output.add.xml", 'w') as out:
out.write(states_xml.toXML())
Please be aware that I did not test the code above.

play_and_get_digits no input vs wrong input in Freeswitch

I am trying to implement the play_and_get_digits using ESL in nodejs.
The code is quite simple:
conn.execute('play_and_get_digits', ${minValue} ${maxValue} ${tries} ${timeout} ${terminator} ${soundFile} ${invalidFile} ${var_name} ${regex} ${digit_timeout}`);
It works well. My only problem is when the caller does not enter anything. By default, it plays the audio defined in invalidFile which I use to inform the caller the value they entered is not valid. I would like to be able to differentiate between wrong input (e.g. digit 5 when only 1 or 2 are allowed) and no input at all.
What would the best way to do this be?
Thanks!

multiValueQueryStringParameters missing from lambda call

I made a call to an API Gateway connected to a Lambda function. I was expecting to see multiValueQueryStringParameters as a key in the event input to my handler.
https://aws.amazon.com/blogs/compute/support-for-multi-value-parameters-in-amazon-api-gateway/
Instead, I was seeing a comma delimited list in queryStringParameters
So for example, this call:
https://12324234234234.execute-api.us-east-2.amazonaws.com/dois_to_pmids?a=1&a=2&a=3
generates the following event entry:
"queryStringParameters": {"a": "1,2,3"}
I tried making everything a proxy integration, first be doing:
GET /{proxy+}
and then by doing:
ANY /{proxy+}
with no luck.
https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-set-up-simple-proxy.html
https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html
What's going on?
So after a bit of digging I discovered an option when setting up the integration to select a payload version (either 1 or 2). You can currently read about the payload version formats (sort of, details are a bit light) here:
https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html
The main takeaway from that link is that version 2 doesn't have multiValueQueryStringParameters, instead repeated parameters are concatenated together in a comma separated list (as observed).
Haven't tested how this works with values that have commas :/

OpenMDAO v1.x: output of sub Group in ParallelGroup does not exist

When running in parallel I am unable to connect unknowns of subgroups in a ParallelGroup() even though I can connect to the subgroups' params. The code causing the problem (with names changed for clarity) is below. This code is within a group of a larger structure, but is the only place where MPI is being used:
for i in range(0, nTasks):
self.connect('comp_a.output%i' % i, 'parallel_group.sub_group%i.param_a' % i)
self.connect('input_param%i' % i, 'parallel_group.sub_group%i.param_b' % i)
self.connect('parallel_group.sub_group%i.output' % i, 'comp_b.input%i' % i)
The first two connections seem to work fine, but the last one throws an error:
NameError: Source 'parallel_group.sub_group0.output' cannot be connected to target 'comb_b.input0': 'parallel_group.sub_group0.output' does not exist.
Also, if I comment out the offending line, then first line in the loop fails for the second process with the same error message:
NameError: Source 'comp_a.output1' cannot be connected to target 'parallel_group.sub_group1.param_a': 'parallel_group.sub_group1.param_a' does not exist.
All the connections work fine with our serial version of the code. The serial version is the same except that the sub_groups are added directly to the group this code is in rather than being wrapped in parallel_group.
I have tried to look over the tutorials and examples but have not been able to figure what might be wrong. I would really appreciate any suggestions of what to check or what may be wrong. Sorry to not post a complete code sample.
its a little unclear, but it sounds like you've added a new group in the parallel version of the code, named "parallel_group". When you did this, did you promote anything (or everything) from that group? If so, then you shouldn't add the parallel group into the variable name path for the connection.
That seems like the only thing likely to trip you up. I could try to debug a bit more if you can come up with a sample code you can post up here that would show the problem.

How to get the 'current observation data' from the NDFD (NOAA, NWS) REST service?

I'm trying to use the NDFD (National Digital Forecast Database) to get current temperature and relative humidity given a Lat and Long using their REST based service.
The issue at hand:
I can't match the 'current observation data' WITH the 'results' I get back from the REST-service.
The setup:
Location:
* Apple (1-infinite loop, Cupertino, California)
* Lat = 37.33; Lon = -122.03
If I issue the following REST-call:
http://www.weather.gov/forecasts/xml/sample_products/browser_interface/ndfdXMLclient.php?lat=37.33&lon=-122.03&product=time-series&begin=2009-06-21T17:12:35&end=2009-06-21T17:12:35&appt=appt&rh=rh&temp_r=temp_r&temp=temp
Note 1: I'm passing the begin and end time in UTC. They're the same because I'm
looking for just a single-point-in-time: the latest observed
temp and relative humidity.
AND, then compare it to what is the closet reporting stations (San Jose International Airport, CA - KSJC - 37.37N 121.93W) # http://www.weather.gov/xml/current_obs/KSJC.xml
** I can never get them to MATCH. **
Note 2: The nearest reporting station is return back from the REST call
as well, so I know I'm comparing Location apples to Location apples.
I've had two ideas:
1: I'm doing something wrong with how I'm passing in the begin/end times into the REST call...
2: You can't get 'current observed data' the way I'm trying to...
Lastly:
I've found a solution using outoftime's NOAA ruby lib , [it parses an observation stations YAML file to find the nearest one given Lat/Lng then goes directly to that station via its identifier i.e. http://www.weather.gov/xml/current_obs/KSJC.xml].... but it just feels like I may be missing something obvious here and would like to use the REST-based interface ;)
Any help or pointers would be appreciated!
Thanks!
It looks like the service you are calling isn't for current data. Judging by the URL and the XML results it seems to be for forecasts. You can also put in future dates to get future forecast data. It expects the dates to be in the -0700 time zone according to the response. I'm not sure which service you should be calling to get the data you want though.
I know that this is an old question, but this is what I'm using to get current weather conditions: http://forecast.weather.gov/MapClick.php?lat=43.09110&lon=-79.0162&unit=0&lg=english&FcstType=dwml
Found this api/link yesterday. Its still developmental (operation-mode="developmental"):
http://forecast.weather.gov/MapClick.php?lat=37.33&lon=-122.03&FcstType=dwml
If you want the "current" observation, you use the XML here:
http://w1.weather.gov/xml/current_obs/seek.php?state=or&Find=Find
e.g.,:
http://w1.weather.gov/xml/current_obs/KAST.xml
If you click on the link you'll get a rendered page. However, if you pull from it using normal rest methods or just wget, it delivers an xml file.

Resources