absolute_codec_string not working in dialplan - freeswitch

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

Related

Cannot determine ethernet address for proxy ARP (Cent OS PPTP VPN)

I've installed pptpd on CentOS 7 with AWS EC2 and I can connect to vpn with windows client but I have no internet access while the server has full internet access. In pptpd log I noticed the error "Cannot determine ethernet address for proxy ARP".
I've changed the dns in /etc/ppp/options.pptpd as below:
ms-dns 8.8.8.8
ms-dns 8.8.4.4
I've also created users in /etc/ppp/chap-secrets and clients can connect without problem (but with no internet access.)
I've also enabled IP forwarding in /etc/sysctl.conf
net.ipv4.ip_forward = 1
and execute this command:
sudo sysctl -p
I changed local and remote IPs in /etc/pptpd.conf as below:
localip 192.168.10.1
remoteip 192.168.20.10-100
I configured firewall for IP masquerading:
sudo iptables -t nat -A POSTROUTING -o ens5 -j MASQUERADE
This is the ifconfig result:
ens5: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 9001
inet 172.31.28.246 netmask 255.255.240.0 broadcast 172.31.31.255
inet6 fe80::4e6:11ff:fed8:bb4a prefixlen 64 scopeid 0x20<link>
ether 06:e6:11:d8:bb:4a txqueuelen 1000 (Ethernet)
RX packets 3668 bytes 347939 (339.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 3111 bytes 385009 (375.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 6 bytes 416 (416.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 6 bytes 416 (416.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ppp0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1396
inet 192.168.10.1 netmask 255.255.255.255 destination 192.168.20.10
ppp txqueuelen 3 (Point-to-Point Protocol)
RX packets 40 bytes 3158 (3.0 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 8 bytes 104 (104.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
And this is the pptpd status (I could connect to the VPN successful but could not access the internet):
[root#ip-172-31-28-246 ~]# systemctl status pptpd
● pptpd.service - PoPToP Point to Point Tunneling Server
Loaded: loaded (/usr/lib/systemd/system/pptpd.service; enabled; vendor preset: disabled)
Active: active (running) since Sun 2021-08-22 09:24:41 UTC; 2min 9s ago
Main PID: 1476 (pptpd)
CGroup: /system.slice/pptpd.service
├─1476 /usr/sbin/pptpd -f
├─1505 pptpd [171.213.14.133:ED5A - 0000]
└─1506 /usr/sbin/pppd local file /etc/ppp/options.pptpd 115200 192.168.10.1:192.168.20.10 ipparam 171.213.14.133 plugin /usr/lib64/pptpd/pptpd-logwtmp.so pptpd-original-ip 171.213.14.133 remote...
Aug 22 09:25:28 ip-172-31-28-246.ap-east-1.compute.internal pptpd[1505]: CTRL: Starting call (launching pppd, opening GRE)
Aug 22 09:25:28 ip-172-31-28-246.ap-east-1.compute.internal pppd[1506]: Plugin /usr/lib64/pptpd/pptpd-logwtmp.so loaded.
Aug 22 09:25:28 ip-172-31-28-246.ap-east-1.compute.internal pppd[1506]: pppd 2.4.5 started by root, uid 0
Aug 22 09:25:28 ip-172-31-28-246.ap-east-1.compute.internal pppd[1506]: Using interface ppp0
Aug 22 09:25:28 ip-172-31-28-246.ap-east-1.compute.internal pppd[1506]: Connect: ppp0 <--> /dev/pts/1
Aug 22 09:25:32 ip-172-31-28-246.ap-east-1.compute.internal pppd[1506]: peer from calling number 171.213.14.133 authorized
Aug 22 09:25:32 ip-172-31-28-246.ap-east-1.compute.internal pppd[1506]: MPPE 128-bit stateless compression enabled
Aug 22 09:25:34 ip-172-31-28-246.ap-east-1.compute.internal pppd[1506]: Cannot determine ethernet address for proxy ARP
Aug 22 09:25:34 ip-172-31-28-246.ap-east-1.compute.internal pppd[1506]: local IP address 192.168.10.1
Aug 22 09:25:34 ip-172-31-28-246.ap-east-1.compute.internal pppd[1506]: remote IP address 192.168.20.10

Firefox generated offer isn't accepted by native WebRTC SDK

I'm trying to connect my iOS/Android app that uses native WebRTC framework to web
While Chrome works just fine, Firefox generates invalid offer
iOS responds with RTCPeerConnection::setRemoteDescription: Error Failed to set remote offer sdp: Failed to set remote data description send parameters. and android just crashes with signal 11
Here is SDP offer generated by Firefox
v=0
o=mozilla...THIS_IS_SDPARTA-69.0.2 1330778261957800593 0 IN IP4 127.0.0.1
s=-
t=0 0
a=fingerprint:sha-256 52:13:5A:F1:78:DA:88:9E:B5:F6:6D:A6:3B:E5:8C:6C:3A:0C:1C:BB:9F:8D:2D:FB:54:1E:DC:8F:2B:32:46:7E
a=group:BUNDLE 0 1 2
a=ice-options:trickle
a=msid-semantic:WMS *
m=video 9 UDP/TLS/RTP/SAVPF 120 121 126 97
c=IN IP4 127.0.0.1
a=sendrecv
a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:mid
a=extmap:4 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=extmap:5 urn:ietf:params:rtp-hdrext:toffset
a=fmtp:126 profile-level-id=42e01f;level-asymmetry-allowed=1;packetization-mode=1
a=fmtp:97 profile-level-id=42e01f;level-asymmetry-allowed=1
a=fmtp:120 max-fs=12288;max-fr=60
a=fmtp:121 max-fs=12288;max-fr=60
a=ice-pwd:0b05e736dc7b9b60e6045bb32ecf1a4a
a=ice-ufrag:2a06fb0e
a=mid:0
a=msid:- {2c03d601-9874-c541-88e5-fdf246db7ceb}
a=rtcp-fb:120 nack
a=rtcp-fb:120 nack pli
a=rtcp-fb:120 ccm fir
a=rtcp-fb:120 goog-remb
a=rtcp-fb:121 nack
a=rtcp-fb:121 nack pli
a=rtcp-fb:121 ccm fir
a=rtcp-fb:121 goog-remb
a=rtcp-fb:126 nack
a=rtcp-fb:126 nack pli
a=rtcp-fb:126 ccm fir
a=rtcp-fb:126 goog-remb
a=rtcp-fb:97 nack
a=rtcp-fb:97 nack pli
a=rtcp-fb:97 ccm fir
a=rtcp-fb:97 goog-remb
a=rtcp-mux
a=rtpmap:120 VP8/90000
a=rtpmap:121 VP9/90000
a=rtpmap:126 H264/90000
a=rtpmap:97 H264/90000
a=setup:actpass
a=ssrc:89993993 cname:{4f658c59-75d0-c34f-b6f3-3abde4bd69f3}
m=audio 9 UDP/TLS/RTP/SAVPF 109 9 0 8 101
c=IN IP4 127.0.0.1
a=sendrecv
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=extmap:2/recvonly urn:ietf:params:rtp-hdrext:csrc-audio-level
a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:mid
a=fmtp:109 maxplaybackrate=48000;stereo=1;useinbandfec=1
a=fmtp:101 0-15
a=ice-pwd:0b05e736dc7b9b60e6045bb32ecf1a4a
a=ice-ufrag:2a06fb0e
a=mid:1
a=msid:- {9f4e7ccb-6c53-da4d-a1d2-6e8bfe79ed05}
a=rtcp-mux
a=rtpmap:109 opus/48000/2
a=rtpmap:9 G722/8000/1
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000/1
a=setup:actpass
a=ssrc:2126371479 cname:{4f658c59-75d0-c34f-b6f3-3abde4bd69f3}
m=application 9 UDP/DTLS/SCTP webrtc-datachannel
c=IN IP4 127.0.0.1
a=sendrecv
a=ice-pwd:0b05e736dc7b9b60e6045bb32ecf1a4a
a=ice-ufrag:2a06fb0e
a=mid:2
a=setup:actpass
a=sctp-port:5000
a=max-message-size:1073741823
What's wrong with it?
I'm using Firefox Quantum 69.0.2
UPD: I've disabled data channels and now it's fine, so issue is somewhere in last 4 lines
The problem is you're using rtp datachannels, which are obsolete and non-standard.
To fix it, locate and remove any mention of DtlsSrtpKeyAgreement and RtpDataChannels.
These were old experiments that only work in Chrome. Chances are you copied them from an old book, and don't really need them. But they continue to create interop headaches, because people cut'n'paste and assume Chrome is correct in supporting them.
All browsers support standard datachannels these days, even Chrome, so there's really no reason to add these problem keywords.
Since disabling data channel solves the problem for now my guess is that the other endpoints can't handle Firefox spec compliant way of signaling data channels with webrtc-datachannel in the m=application line, but still expect a port number there instead.
What actually helped me is following settings in constraints:
{'DtlsSrtpKeyAgreement': isFirefox},
{"RtpDataChannels" : !isFirefox},

How can I rewrite SDP with switch_r_sdp in freeswitch?

v=0
o=- 1358463684 1358463684 IN IP4 xxx.xxx.xxx.xxx
s=Opal SIP Session
c=IN IP4 xxx.xxx.xxx.xxx
t=0 0
m=audio 3144 RTP/AVP 19 3 101 120
c=IN IP4 xxx.xxx.xxx.xxx
a=rtpmap:18 G729/8000/1
a=fmtp:18 annexb=no
a=rtpmap:3 gsm/8000/1
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16,32,36
a=rtpmap:120 NSE/8000
a=fmtp:120 192-193
In the above SDP, I would like to change the IP address xxx.xxx.xxx.xxx
to different yyy.yyy.yyy.yyy. I searched in the internet and found that I need to use "action application="set"![CDATA[(sdp here)]] /action"
But I am not sure what is the exact changes I need to make. Please help me.
If you're behind NAT, you can configure the external RTP in your Sofia SIP Profile:
<param name="ext-rtp-ip" value="yyy.yyy.yyy.yyy"/>
FreeSwitch will then present this IP in outgoing SDP.
https://freeswitch.org/confluence/display/FREESWITCH/Sofia+SIP+Stack

originate conference from python esl

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.

AB (Apache benchmark) to the authenticate

I want to test the performance of my apache with AB (Apache Benchemark) with parameter authentication.
I followed this tutorial step
Using Apache Benchmark (ab) on sites with authentication
and when I execute the command
ab-c 1-n 1-C PHPSESSID = 65pnirttcbn0l6seutjkf28452 http://my-web-site
but authentication does not pass
testeur#ERP:~$ ab -c 1 -n 1 -C PHPSESSID=65pnirttcbn0l6seutjkf28452 http:my-web-site.com/mapviewimproved
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, `http://www.zeustech.net/`
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking my-web-site.com (be patient).....done
Server Software: Apache
Server Hostname: algeotrack.com
Server Port: 80
Document Path: /my-page
Document Length: 0 bytes
Concurrency Level: 1
Time taken for tests: 0.627 seconds
Complete requests: 1
Failed requests: 0
Write errors: 0
Non-2xx responses: 1
Total transferred: 335 bytes
HTML transferred: 0 bytes
Requests per second: 1.59 [#/sec] (mean)
Time per request: 627.320 [ms] (mean)
Time per request: 627.320 [ms] (mean, across all concurrent requests)
Transfer rate: 0.52 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 36 36 0.0 36 36
Processing: 591 591 0.0 591 591
Waiting: 591 591 0.0 591 591
Total: 627 627 0.0 627 627
I note that the application is developed with Zend Framework 1
is that you can help me please
You have to quote the cookie value:
ab -c 1 -n 1 -C 'PHPSESSID=65pnirttcbn0l6seutjkf28452' http:my-web-site.com/mapviewimproved
see this other question as reference: How do I pass a complex cookie to ab for testing?

Resources