Asterisk: PJSIP_HEADER and Websocket - websocket

I need to add custom header when calling the client's webrtc. Used by asterisk 13 + siphtml5.
Dialplan:
exten => 198,1,Answer()
same => n,Set(PJSIP_HEADER(add,X-DRP)=71234567890)
same => n,DIAL(PJSIP/${EXTEN})
Asterisk log:
Connected to Asterisk 13.17.2 currently running on ubuntu-xenial (pid = 8895)
== WebSocket connection from '192.168.0.44:58096' forcefully closed due to fatal write error
== WebSocket connection from '192.168.0.44:58595' for protocol 'sip' accepted using version '13'
-- Added contact 'sip:a9gn89sg#192.168.0.44:58595;transport=ws' to AOR '199' with expiration of 450 seconds
== Contact 199/sip:a9gn89sg#192.168.0.44:58595;transport=ws has been created
== Contact 199/sip:3qogi2fo#192.168.0.44:58096;transport=ws has been deleted
-- Contact 199/sip:a9gn89sg#192.168.0.44:58595;transport=ws is now Unknown. RTT: 0.000 msec
== Setting global variable 'SIPDOMAIN' to 'aster13'
== DTLS ECDH initialized (automatic), faster PFS enabled
-- Executing [198#default:1] Answer("PJSIP/199-00000008", "") in new stack
> 0x7f0ea0071960 -- Strict RTP learning after remote address set to: 123.135.239.111:58827
[Oct 23 16:02:31] ERROR[8943]: pjproject:0 <?>: icess0x7f0ea000ce18 ..Error sending STUN request: Network is unreachable
[Oct 23 16:02:31] ERROR[8943]: pjproject:0 <?>: icess0x7f0ea000ce18 ..Error sending STUN request: Network is unreachable
> 0x7f0ea0071960 -- Strict RTP learning after ICE completion
> 0x7f0ea0071960 -- Strict RTP switching to RTP target address 192.168.100.97:58827 as source
-- Executing [198#default:2] SIPAddHeader("PJSIP/199-00000008", "X-DRP: 79161234567") in new stack
-- Executing [198#default:3] Set("PJSIP/199-00000008", "PJSIP_HEADER(add,X-DRP)=79161234567") in new stack
-- Executing [198#default:4] Verbose("PJSIP/199-00000008", "Set(OldContact="199" <sips:199#192.168.100.97:54514;transport=ws;rtcweb-breaker=no;click2call=no>;+g.oma.sip-im;language="en,fr")") in new stack
Set(OldContact=199 <sips:199#192.168.100.97:54514;transport=ws;rtcweb-breaker=no;click2call=no>;+g.oma.sip-im;language=en,fr)
-- Executing [198#default:5] Dial("PJSIP/199-00000008", "PJSIP/198") in new stack
-- Called PJSIP/198
-- PJSIP/199-00000008 requested media update control 26, passing it to PJSIP/198-00000009
== DTLS ECDH initialized (automatic), faster PFS enabled
-- PJSIP/198-00000009 is ringing
> 0x7f0ea0071960 -- Strict RTP learning complete - Locking on source address 192.168.100.97:58827
== Everyone is busy/congested at this time (1:0/0/1)
-- Executing [198#default:7] Hangup("PJSIP/199-00000008", "") in new stack
== Spawn extension (default, 198, 7) exited non-zero on 'PJSIP/199-00000008'
-- Added contact 'sips:199#192.168.100.97:54514;transport=ws;rtcweb-breaker=no' to AOR '199' with expiration of 200 seconds
== Contact 199/sips:199#192.168.100.97:54514;transport=ws;rtcweb-breaker=no has been created
== Contact 199/sip:a9gn89sg#192.168.0.44:58595;transport=ws has been deleted
-- Contact 199/sips:199#192.168.100.97:54514;transport=ws;rtcweb-breaker=no is now Unknown. RTT: 0.000 msec
And I can't find header X-DRP in debug log of my browser:
recv=INVITE sips:198#192.168.100.97:54445;transport=ws;rtcweb-breaker=no SIP/2.0
Via: SIP/2.0/WSS 192.168.100.97:54445;rport;branch=z9hG4bKPja4ca4b5b-62c2-4953-a761-d13d34696007;alias
From: "199"<sip:199#ubuntu-xenial>;tag=a1b0c71d-f89b-4226-a84e-82e7db8b2b21
To: <sips:198#192.168.100.97;rtcweb-breaker=no>
Contact: <sips:asterisk#ubuntu-xenial:5060;transport=ws>
Call-ID: a47911b2-c6d4-4222-961b-f0418a4e00c0
CSeq: 30108 INVITE
Content-Type: application/sdp
Content-Length: 1085
Allow: OPTIONS,SUBSCRIBE,NOTIFY,PUBLISH,INVITE,ACK,BYE,CANCEL,UPDATE,PRACK,REGISTER,MESSAGE,REFER
Supported: 100rel,timer,replaces,norefersub
Session-Expires: 1800;refresher=uac
Min-SE: 90
Max-Forwards: 70
User-Agent: Asterisk PBX 13.17.2
v=0
o=- 780155122 780155122 IN IP4 192.168.49.32
s=Asterisk
c=IN IP4 192.168.49.32
t=0 0
m=audio 15018 UDP/TLS/RTP/SAVPF 0 101
a=connection:new
a=setup:actpass
a=fingerprint:SHA-256 AA:94:9A:8F:24:9A:BD:C2:6B:BA:57:4D:E2:D3:1F:1E:B1:F9:87:B1:96:C7:29:93:B8:75:16:D6:73:9D:1E:3E
a=ice-ufrag:3e3de33532c2fcdc32d71b2f086be032
a=ice-pwd:78e4b4b93a861933107a205a10cac6dd
a=candidate:Hc92a8000 1 UDP 2130706431 fe80::14:68ff:fe3e:8447 15018 typ host
a=candidate:H6893915f 1 UDP 2130706431 fe80::a00:27ff:feeb:a9e 15018 typ host
a=candidate:Ha00020f 1 UDP 2130706431 10.0.2.15 15018 typ host
a=candidate:Hc0a83120 1 UDP 2130706431 192.168.49.32 15018 typ host
a=candidate:Hc92a8000 2 UDP 2130706430 fe80::14:68ff:fe3e:8447 15019 typ host
a=candidate:H6893915f 2 UDP 2130706430 fe80::a00:27ff:feeb:a9e 15019 typ host
a=candidate:Ha00020f 2 UDP 2130706430 10.0.2.15 15019 typ host
a=candidate:Hc0a83120 2 UDP 2130706430 192.168.49.32 15019 typ host
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv
a=rtcp-mux
Is PJSIP supports PJSIP_HEADER for WebSocket? Is there any other way to add custom header to INVOTE for webrtc client?
I use asterisk 13, and siphtml5 web client. Also I check wss traffic with wireshark, decrypt it and still can't find X-DRP header.

In asterisk set header using:
same => n,SIPAddHeader(HEADERNAME: ${SOMEVAR})
You need use a more updated library like jsSip in client. In this case you cant get the server header like this:
phone.on('newRTCSession', function(e){
if (e.originator == 'remote') {
console.log(e.request.headers);
}
});

Related

SNMPGET works from program but not from CLI

I am working on an fax grabber, for a fax in our building only Samsung provides the software "Samsung Easy Printer Manager" the program sends an SNMPGET to the Printer as I saw in Wireshark
Frame 133: 89 bytes on wire (712 bits), 89 bytes captured (712 bits) on interface bridge102, id 5
Ethernet II, Src: Parallel_53:1e:29 (Mac), Dst: SamsungE_69:6f:fe (Mac)
Internet Protocol Version 4, Src: 192.168.178.125, Dst: 192.168.178.38
User Datagram Protocol, Src Port: 55160, Dst Port: 161
Simple Network Management Protocol
version: version-1 (0)
community: Test
data: get-request (0)
get-request
request-id: 10944
error-status: noError (0)
error-index: 0
variable-bindings: 1 item
1.3.6.1.4.1.236.11.5.11.81.12.16.1.2.1: Value (Null)
Object Name: 1.3.6.1.4.1.236.11.5.11.81.12.16.1.2.1 (iso.3.6.1.4.1.236.11.5.11.81.12.16.1.2.1)
Value (Null)
[Response To: 134]
[Time: 0.000019000 seconds]
Answer:
Frame 135: 93 bytes on wire (744 bits), 93 bytes captured (744 bits) on interface vmenet2, id 2
Ethernet II, Src: SamsungE_69:6f:fe (Mac), Dst: Parallel_53:1e:29 (Mac)
Internet Protocol Version 4, Src: 192.168.178.38, Dst: 192.168.178.125
User Datagram Protocol, Src Port: 161, Dst Port: 55160
Simple Network Management Protocol
version: version-1 (0)
community: Test
data: get-response (2)
get-response
request-id: 10944
error-status: noError (0)
error-index: 0
variable-bindings: 1 item
1.3.6.1.4.1.236.11.5.11.81.12.16.1.2.1: 01000000
Object Name: 1.3.6.1.4.1.236.11.5.11.81.12.16.1.2.1 (iso.3.6.1.4.1.236.11.5.11.81.12.16.1.2.1)
Value (OctetString): 01000000
[Response To: 134]
[Time: 0.012747000 seconds]
But if im sending the get Request from my Laptop I get:
SNMPv2-SMI::enterprises.236.11.5.11.81.12.16.1.2.1 = No Such Instance currently exists at this OID
and after i googled the OID there was no result.
Any Ideas

Unable to Send ISO 8583 Messages Through JMeter

I am using ISO8583 Sampler in JMeter for Sending ISO Messages, i had put Necessary Plugins & JAR files like JPOS. However i get "MTI not available" in the Sampler Response
Settings in ISO8583 Connection Configuration
Packager Configuration :- test-generic-validating-packager.xml file from JPOS 2.1.4
Host Name :- 192.168.1.104
Port Number :- 8080
Field wise Data in ISO8583 Sampler
003 380000
011 00000000XXXX
012 20200821${__time(HHmmss,)}
017 20200821
024 200
032 0
034 000000
041 0000000000000MBK
049 INR
102 IBKL 01310200000XXXX
123 MBK
Output of Sampler
Thread Name: Thread Group 1-1
Sample Start: 2020-08-21 17:18:09 IST
Load time: 0
Connect Time: 0
Latency: 0
Size in bytes: 0
Sent bytes:0
Headers size in bytes: 0
Body size in bytes: 0
Sample Count: 1
Error Count: 1
Data type ("text"|"bin"|""): text
Response code:
Response message: org.jpos.iso.ISOException: MTI not available
When i put MTI as 1200 or 0800 in the ISO Sampler, JMeter is unable to send the Request to the Server
Can someone help me out in this??
The same i able to process with Neoload Tool..
As per this documentation aren’t you missing the configuration of field 0 for MTI:
https://github.com/tilln/jmeter-iso8583#iso8583-sampler

How check bus state in socketcan

I am using flexcan driver on an embedded linux and I have C program controling can messages. In my C program I need to check the state of the can bus e.g. buss-off or error-active. I can use linux command like
ip -details -statistics link show can0 with following result:
2: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP mode DEFAULT group default qlen 10
link/can promiscuity 0
can state *ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 100
bitrate 250000 sample-point 0.866
tq 266 prop-seg 6 phase-seg1 6 phase-seg2 2 sjw 1
flexcan: tseg1 4..16 tseg2 2..8 sjw 1..4 brp 1..256 brp-inc 1
clock 30000000
re-started bus-errors arbit-lost error-warn error-pass bus-off
31594 0 0 7686 25577 33258
RX: bytes packets errors dropped overrun mcast
5784560 723230 0 1 0 0
TX: bytes packets errors dropped carrier collsns
157896 19742 0 33269 0 0
How can I get that can state ERROR-ACTIVE in my C program? Also I can see in the flex can driver there are some registers that can be used to see the state but I don't know how to include these values in my program also. registers like FLEXCAN_ESR_BOFF_INT contains the values that I need.
You can setup your socket to return CAN errors as messages.
As described in Network Problem Notifications the CAN interface driver
can generate so called Error Message Frames that can optionally be
passed to the user application in the same way as other CAN frames.
The possible errors are divided into different error classes that may
be filtered using the appropriate error mask. To register for every
possible error condition CAN_ERR_MASK can be used as value for the
error mask. The values for the error mask are defined in
linux/can/error.h
can_err_mask_t err_mask = ( CAN_ERR_TX_TIMEOUT | CAN_ERR_BUSOFF );
setsockopt(s, SOL_CAN_RAW, CAN_RAW_ERR_FILTER,
&err_mask, sizeof(err_mask));
See kernel documentation for more information.
Update
Take a look at libsocketcan and the routine can_get_state.

WebRTC live stream(H264) error in Firefox, can't generate valid SDP answer

I am trying to run H264 encoded live stream in Web Browser using Janus WebRTC Gateway. While testing with Chrome, the stream works fine but with firefox it shows ICE failed, add a TURN server and see about:webrtc for more details.
Following is my about:webrtc logs for firefox.
[ 6442450983 ] http://192.168.2.194:5000/ 15:18:19 GMT+0530 (IST)
PeerConnection ID: 1515491295667117 (id=6442450983 url=http://192.168.2.194:5000/)
ICE Stats
Local Candidate Remote Candidate ICE State Priority Nominated Selected Bytes sent Bytes received
ICE restarts:
ICE rollbacks:
SDP
Local SDP
v=0
o=mozilla...THIS_IS_SDPARTA-57.0.4 3500649212029345392 0 IN IP4 0.0.0.0
s=-
t=0 0
a=sendrecv
a=fingerprint:sha-256 11:44:F1:BD:D1:69:8E:17:E0:9A:AA:89:8E:76:9F:4E:09:E1:94:D0:37:34:EE:FE:DF:5E:FC:77:B0:4D:F7:53
a=ice-options:trickle
a=msid-semantic:WMS *
m=video 0 RTP/SAVPF 120
c=IN IP4 0.0.0.0
a=inactive
a=end-of-candidates
a=mid:video
a=rtpmap:120 VP8/90000
Remote SDP
v=0
o=- 1515491295396595 1515491295396595 IN IP4 106.51.68.195
s=-
t=0 0
a=sendrecv
a=group:BUNDLE video
a=msid-semantic:WMS janus
m=video 9 RTP/SAVPF 126
c=IN IP4 106.51.68.195
a=candidate:1 1 udp 2013266431 192.168.2.194 45887 typ host
a=candidate:2 1 udp 1677722111 106.51.68.195 45887 typ srflx raddr 192.168.2.194 rport 45887
a=sendonly
a=end-of-candidates
a=fingerprint:sha-256 D2:B9:31:8F:DF:24:D8:0E:ED:D2:EF:25:9E:AF:6F:B8:34:AE:53:9C:E6:F3:8F:F2:64:15:FA:E8:7F:53:2D:38
a=ice-options:trickle
a=ice-pwd:KsS99rsAZXj9lFd7psCT61
a=ice-ufrag:3tcw
a=mid:video
a=rtcp-fb:126 nack
a=rtcp-fb:126 goog-remb
a=rtcp-mux
a=rtpmap:126 H264/90000
a=setup:actpass
a=ssrc:3973486276 cname:janusvideo
a=ssrc:3973486276 msid:janus janusv0
a=ssrc:3973486276 mslabel:janus
a=ssrc:3973486276 label:janusv0
RTP Stats
I even tried adding following TURN Server
{urls: "turn:numb.viagenie.ca",
username: "l1787875#mvrht.com",
credential: "test"}
But the console error changes to ICE failed, your TURN server appears to be broken, see about:webrtc for more details, Keeping the about:webrtc logs same as before.
I figured out that somehow Firefox can't generate a valid answer for SDP offer generated by Janus. Created answer by Firefox has attribute rtpmap: 120 VP8/90000, whereas SDP offer made by Janus has attribute rtpmap: 127 H264/90000, which prevent Firefox to establish a SDP session with Janus. Chrome can generate the valid answer with rtpmap: 127 H264/90000 so it can display the stream perfectly.
I am using Mozilla firefox-57.0.4.
Is there a way, I can get/ generate a valid SDP answer for incoming SDP offer from Janus?
This solution worked for me (last yellow message):
https://groups.google.com/forum/#!topic/meetecho-janus/jKg5u9421kM
I'm using Janus and I was getting the same error in Firefox.
The problem was about the SDP profile-level-id.
I just had to replace it:
// Create offer/answer now
if(jsep === null || jsep === undefined) {
createOffer(handleId, media, callbacks);
} else {
if(adapter.browserDetails.browser === "edge") {
// This is Edge, add an a=end-of-candidates at the end
jsep.sdp += "a=end-of-candidates\r\n";
}
var oldsdp = jsep["sdp"];
var pattern=/420029/gi;
var newsdp = oldsdp.replace(pattern,"42e01f");
Janus.log(newsdp);
jsep["sdp"]=newsdp;
config.pc.setRemoteDescription(
new RTCSessionDescription(jsep),
function() {
Janus.log("Remote description accepted!");
createAnswer(handleId, media, callbacks);
}, callbacks.error);
}
}

Jmeter- soap-xml sampler request

I am using jmeter, I am very new to it and have min programming background.
I am currently using 2 sampler: a) soap Request b) soap xml rpc request.
Uisng the soap request sampler, I can easily load the wsdl file and continue my testing.
RESPONSE
But unable to do so with 'soap xml rpc request' sampler
the message I am getting here is
a:ActionNotSupportedThe message with Action '' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).
SAMPLER RESULT
Thread Name: Thread Group 1-1
Sample Start: 2013-09-27 15:03:07 BST
Load time: 7
Latency: 7
Size in bytes: 698
Headers size in bytes: 0
Body size in bytes: 698
Sample Count: 1
Error Count: 1
Response code: 500
Response message: Internal Server Error
Response headers:
HTTP/1.1 500 Internal Server Error
Content-Length: 698
Content-Type: text/xml; charset=utf-8
Server: Microsoft-HTTPAPI/2.0
Date: Fri, 27 Sep 2013 14:03:07 GMT
Connection: close
HTTPSampleResult fields:
ContentType: text/xml; charset=utf-8
DataEncoding: utf-8
It could be simple - just uncheck the 'Send SOAP Action" checkbox in SOAP/XML-RPC request and try again

Resources