How to connect asterisk to skype using siptosis? - java

I've been trying to do this for weeks and still have not yet figured out how to connect to skype. The best progress I've found out was from this tutorial
http://translate.google.com/translate?hl=en&sl=it&u=http://www.voipandhack.it/archives/linux/asterisk-failover-e-registrazioni-sip&ei=nqJRTNTPB8OfrAfDovGDAw&sa=X&oi=translate&ct=result&resnum=2&ved=0CBoQ7gEwAQ&prev=/search%3Fq%3Dasterisk%2Bauto%2Bfallthrough%2Bsiptosis%26hl%3Den
But whenever I tried to make an echo123 call, my asterisk would show
== Using SIP RTP CoS mark 5
-- Executing [*123#phones:1] Dial("SIP/1004-00000030", "SIP/siptosisuser/echo123") in new stack
== Using SIP RTP CoS mark 5
-- Called siptosisuser/echo123
-- SIP/siptosisuser-00000031 is ringing
-- SIP/siptosisuser-00000031 is circuit-busy
== Everyone is busy/congested at this time (1:0/1/0)
-- Auto fallthrough, channel 'SIP/1004-00000030' status is 'CONGESTION'
and my siptosis will show:
2010-07-30 10:48:21,596 Failed to select RTP format
2010-07-30 10:48:21,597 ### local descriptor=v=0
o=skypests 1280512101 0 IN IP4 192.168..
s=Session SIP/SDP
c=IN IP4 192.168..
t=0 0
m=audio 63202 RTP/AVP 0 8 98 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:98 iLBC/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv
a=silenceSupp:off
2010-07-30 10:48:21,597 ### remote descriptor=v=0
o=root 1729829715 1729829715 IN IP4 127.0.0.1
s=Asterisk PBX 1.6.2.8
c=IN IP4 127.0.0.1
t=0 0
m=audio 18104 RTP/AVP 3 101
a=rtpmap:3 GSM/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv
I've changed my IP address to 192.168.. just for security reasons. It seems to be connecting one way or another but I'm assuming I'm doing something wrong somewhere in the code? I also haven't touched the siptosis.cfg because the tutorial I specified didn't do it. The cfg file also didn't come with the siptosis package I downloaded but I was able to find a copy from another tutorial on the nerdvittle website
This is suppose to be the tutorial that makes it easy to setup but it doesn't seem to work on mine. I just want to have some call to echo123 and it seemed to be not working. I'm working on ubuntu and most tutorials are on CentOS so there's not much to solve my problem. I also am not using static skype, will that be a problem?
Any hints/tip/answers would be very much appreciated!
Thank you for your time and thank you in advance!

I'm not familiar with SipToSis but you may want to look at the Skype Connect (previously known as Skype for SIP) solution which allows you to make and receive calls direct to/from sip.skype.com using SIP. Unlike Skype for Asterisk, it's free.
Apologies if you already know this and are looking for specific features of SipToSis which are not provided by Skype Connect. Good luck.

Related

Android-WebRTC: MediaStream.removeVideoTrack is called after setting local description

We are developing an Android Application with Scala, WebRTC and the Java SDK. Our current task consists of receiving the remote track that is sent in a second SDP negotiation when the Callee enables video. Thus the Caller is accessing that video track in the onAddTrack method of the peer-connection observer. In fact, the track is contained in the Array of MediaStreams, and then we are able to attach it to the VideoRenderer via a ProxySink - pretty much like in this example: https://webrtc.googlesource.com/src/+/refs/heads/master/examples/androidapp/src/org/appspot/apprtc/CallActivity.java#133.
This is the piece of code in charge of that:
override def onAddTrack(rtpReceiver: RtpReceiver, mediaStreams: Array[MediaStream]): Unit = {
info("FLOW: onAddTrack")
rtpReceiver.SetObserver(rtpObserver)
call.getCallType match {
case BothVideo(CallRoles.Caller) | RecvPeerVideo(CallRoles.Caller) => {
if (mediaStreams.size > 0) {
val mediaStream = mediaStreams(0)
val videoTracks: Buffer[VideoTrack] = mediaStream.videoTracks.asScala
this.remoteMediaStream = Some(mediaStream)
info(s"FLOW: onAddTrack, call-type: ${call.getCallType}")
if (call.callerShouldReceiveVideo(call.getCallType) && videoTracks.size > 0) {
info(s"FLOW: onAddTrack, enabling video-track")
val videoTrack: VideoTrack = videoTracks(0)
mediaStream.addPreservedTrack(videoTrack)
videoTrack.setEnabled(true)
videoTrack.addSink(flowManager.remoteProxySink)
...
}
}
}
The problem is that we are not able to get the frames from the Callee's remote track, and this is a bit surprising since we were already able to successfully set the Caller's remote track and render the frames when the Caller initiates the call with video and has to send the remote track to Callee.
We have detected that dispose is being called on the MediaStream (https://webrtc.googlesource.com/src/+/refs/heads/master/sdk/android/api/org/webrtc/MediaStream.java#75) right after setLocalDescription is called in the SdpObserver set when creating the answer, and we think this might be cause of our issue.
Creating answer:
pcConn.setRemoteDescription(sdpObserver, sdp)
peerConn.createAnswer(sdpObserver, WebRTCCall.sdpMediaConstraints())
In SdpObserver:
override def onCreateSuccess(sdp: SessionDescription) = {
...
peerConn.setLocalDescription(this, sdp)
...
}
What can be triggering the MediaStream.dispose method inside native setLocalDescription ?
Update
We found something interesting in the sdp, video track seems to have sendonly direction.
v=0
o=- 2191449863069826960 3 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE 0 1 2 3
a=msid-semantic: WMS stream0
m=audio 56825 UDP/TLS/RTP/SAVPF 111 103 9 102 0 8 105 13 110 113 126
c=IN IP4 35.167.127.194
a=rtcp:9 IN IP4 0.0.0.0
a=candidate:2294452033 1 udp 2122260223 192.168.2.159 60968 typ host generation 0 network-id 3 network-cost 10
a=candidate:559267639 1 udp 2122202367 ::1 39373 typ host generation 0 network-id 2
a=candidate:1510613869 1 udp 2122129151 127.0.0.1 56438 typ host generation 0 network-id 1
a=candidate:1876313031 1 tcp 1518222591 ::1 59473 typ host tcptype passive generation 0 network-id 2
a=candidate:344579997 1 tcp 1518149375 127.0.0.1 47922 typ host tcptype passive generation 0 network-id 1
a=candidate:842163049 1 udp 1686052607 201.233.49.70 60968 typ srflx raddr 192.168.2.159 rport 60968 generation 0 network-id 3 network-cost 10
a=candidate:1600295039 1 udp 41885439 35.167.127.194 56825 typ relay raddr 201.233.49.70 rport 60968 generation 0 network-id 3 network-cost 10
a=candidate:3811514541 1 udp 41885695 34.221.141.99 60923 typ relay raddr 201.233.49.70 rport 60968 generation 0 network-id 3 network-cost 10
a=ice-ufrag:GGkb
a=ice-pwd:owqpzSht95NQb92cgzKNkQmJ
a=ice-options:trickle renomination
a=fingerprint:sha-256 45:76:5A:81:C1:CD:6B:C8:17:C6:CB:7B:20:CD:C6:DD:59:A3:DC:11:47:78:D3:E1:E1:EE:55:1F:83:A5:32:E4
a=setup:passive
a=mid:0
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=extmap:2 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:mid
a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id
a=extmap:5 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id
a=sendrecv
a=msid:stream0 audio0
a=rtcp-mux
a=rtpmap:111 opus/48000/2
a=rtcp-fb:111 transport-cc
a=fmtp:111 minptime=10;useinbandfec=1
a=rtpmap:103 ISAC/16000
a=rtpmap:9 G722/8000
a=rtpmap:102 ILBC/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:105 CN/16000
a=rtpmap:13 CN/8000
a=rtpmap:110 telephone-event/48000
a=rtpmap:113 telephone-event/16000
a=rtpmap:126 telephone-event/8000
a=ssrc:1249625177 cname:IgXNTJvPXp2HndWi
m=video 9 UDP/TLS/RTP/SAVPF 96 97 98 99 100 101 127
c=IN IP4 0.0.0.0
a=rtcp:9 IN IP4 0.0.0.0
a=ice-ufrag:GGkb
a=ice-pwd:owqpzSht95NQb92cgzKNkQmJ
a=ice-options:trickle renomination
a=fingerprint:sha-256 45:76:5A:81:C1:CD:6B:C8:17:C6:CB:7B:20:CD:C6:DD:59:A3:DC:11:47:78:D3:E1:E1:EE:55:1F:83:A5:32:E4
a=setup:passive
a=mid:1
a=extmap:14 urn:ietf:params:rtp-hdrext:toffset
a=extmap:13 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=extmap:12 urn:3gpp:video-orientation
a=extmap:2 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=extmap:11 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay
a=extmap:6 http://www.webrtc.org/experiments/rtp-hdrext/video-content-type
a=extmap:7 http://www.webrtc.org/experiments/rtp-hdrext/video-timing
a=extmap:8 http://tools.ietf.org/html/draft-ietf-avtext-framemarking-07
a=extmap:9 http://www.webrtc.org/experiments/rtp-hdrext/color-space
a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:mid
a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id
a=extmap:5 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id
a=sendonly
a=msid:stream0 video0
a=rtcp-mux
a=rtcp-rsize
a=rtpmap:96 VP8/90000
a=rtcp-fb:96 goog-remb
a=rtcp-fb:96 transport-cc
a=rtcp-fb:96 ccm fir
a=rtcp-fb:96 nack
a=rtcp-fb:96 nack pli
a=rtpmap:97 rtx/90000
a=fmtp:97 apt=96
a=rtpmap:98 VP9/90000
a=rtcp-fb:98 goog-remb
a=rtcp-fb:98 transport-cc
a=rtcp-fb:98 ccm fir
a=rtcp-fb:98 nack
a=rtcp-fb:98 nack pli
a=rtpmap:99 rtx/90000
a=fmtp:99 apt=98
a=rtpmap:100 red/90000
a=rtpmap:101 rtx/90000
a=fmtp:101 apt=100
a=rtpmap:127 ulpfec/90000
a=ssrc-group:FID 1487952389 3127747783
a=ssrc:1487952389 cname:IgXNTJvPXp2HndWi
a=ssrc:3127747783 cname:IgXNTJvPXp2HndWi
m=application 9 DTLS/SCTP 5000
c=IN IP4 0.0.0.0
b=AS:30
a=ice-ufrag:GGkb
a=ice-pwd:owqpzSht95NQb92cgzKNkQmJ
a

How to read data from GPS Device (TK06A)

I am a newbie into GPS application and i am stuck with one of the project. I want to read data (Lat / Long) from this GPS device (TK06A). For the time being i am using Hercules SETUP Utility bu HW-group. The data in text format is just garbage while if i convert it to HEX it appears as following
{78}{78}{0D}{01}{03}{55}{48}{80}{00}{03}{53}{63}{00}{15}{2E}{44}{0D}{0A}
{78}{78}{0D}{01}{03}{55}{48}{80}{00}{03}{53}{63}{00}{15}{2E}{44}{0D}{0A}
{78}{78}{1F}{12}{0F}{09}{17}{11}{26}{06}{C8}{01}{FD}{4D}{C0}{07}{EC}{09}
{E8}{00}{34}{71}{01}{94}{1B}{00}{BE}{00}{34}{E6}{00}{15}{35}{7C}{0D}{0A}
While the HEX data makes certain sense as per the protocol, i am unable to understand the lat / long from this. This is the link to the protocol manual as given by the vendor
Link to Protocol Manual for GPS Tracker TK06A
I have also tried to write a JAVA code to read the TCP port and print the same but again it was of no help.
Let's say you have received the packet as below :
Login string : 78780d0103554880249067690016bd720d0a
7878 - Start bit
0d - Length
01 - Protocol no.
0355488024906769 - IMEI
0016 - Serial number
bd72 - CRC
0d0a - Stop bit
Data string: 78781f120f0b050e2536c601fb782d07ed996b00345d01941b00b8002f51001634210d0a
7878 - Start bit
1f - Length of data
12 - Protocol no.
0f0b050e2536 - Time and date
c6 - GPS info length/number of satellites involved in locating. 4-bit - GPS length. 4-bit number of satellites.
01fb782d - Latitude
07ed996b - Longitude
00 - Speed
345d - Status/Course
0194 - Mobile Country Code
1b - Mobile Network Code
00b8 - Location Area Code
002f51 - Cell Tower ID
0016 - Serial information
3421 - Error checking
0d0a -Stop bit
Note: Before using the above hex data convert it into decimal for each parameter.
Let me know if this helps or any other help is required :)

pcap4j gotPacket(..) returns non ascii chars before SIP message. Why?

I am using PCap4j (a simple Java wrapper for libpcap) to sniff SIP packets on localhost in promiscuous mode. The SIP packets are sent and received by SIPP - a SIP packet test generator.
When receiving a UDP packet in the gotPacket() method, there are a number of strange chars in the start of the received raw packet data. Why is this so? What am I missing here?
I need the buffer to start with SIP INVITE. Is there another protocol wrapping the SIP data? How does one reliably remove the gibberish in the front from the SIP messages. The libpcap filter is set to "udp port sip".
Much appreciate
PacketListener listener = new PacketListener() {
public void gotPacket(Packet packet) {
String p = new String(packet.getRawData());
System.out.println(p);
}
}
E(0#��(INVITE sip:service#127.0.0.1:5060 SIP/2.0
Via: SIP/2.0/UDP 127.0.0.1:5061;branch=z9hG4bK-99365-511233-0
From: sipp <sip:sipp#127.0.0.1:5061>;tag=99365SIPpTag00511233
To: service <sip:service#127.0.0.1:5060>
Call-ID: 511233-99365#127.0.0.1
CSeq: 1 INVITE
Contact: sip:sipp#127.0.0.1:5061
Max-Forwards: 70
Subject: Performance Test
Content-Type: application/sdp
Content-Length: 129
v=0
o=user1 53655765 2353687637 IN IP4 127.0.0.1
s=-
c=IN IP4 127.0.0.1
t=0 0
m=audio 6001 RTP/AVP 0
a=rtpmap:0 PCMU/8000
A packet in gotPacket() includes an Ethernet header, an IP header, and a UDP header (if you get it from Ethernet network).
To get its UDP payload, do the following: packet.get(UdpPacket.class).getPayload().getRawData()

lwuit Resource limit exceeded for TCP client sockets

I use lwuit and browser about 20 pages,
and then i got execption:
java.io.IOException: Resource limit exceeded for TCP client sockets
- com.sun.midp.io.j2me.socket.Protocol.open0(), bci=0
- com.sun.midp.io.j2me.socket.Protocol.connect(), bci=142
- com.sun.midp.io.j2me.socket.Protocol.open(), bci=133
- com.sun.midp.io.j2me.socket.Protocol.openPrim(), bci=4
- com.sun.midp.io.j2me.http.Protocol.createConnection(), bci=13
- com.sun.midp.io.j2me.http.Protocol.connect(), bci=43
- com.sun.midp.io.j2me.http.Protocol.streamConnect(), bci=109
- com.sun.midp.io.j2me.http.Protocol.startRequest(), bci=9
- com.sun.midp.io.j2me.http.Protocol.sendRequest(), bci=35
- com.sun.midp.io.j2me.http.Protocol.sendRequest(), bci=3
- com.sun.midp.io.j2me.http.Protocol.getHeaderField(), bci=5
- com.sun.lwuit.browser.HttpRequestHandler.resourceRequested(HttpRequestHandler.java:138)
- com.sun.lwuit.html.HTMLComponent$2.run(HTMLComponent.java:817)
HttpRequestHandler->IOException: Resource limit exceeded for TCP client sockets
Error connecting to stream
anyone can tell me how to fix it?
You should probably close the TCP sockets after using them. Otherwise they stay around in an open state, and if the operating system allows only 20 connections to be open at a time, you will get this exception.

Does anyone here know a good, cross-platform way to get the process list?

Okay, I got into a conversation with a friend about Ada (I'm the local proponent here), and in his project he's having a pain trying to get Java (using JNI) to get the applications running on the client machine (only Windows, Mac, and Linux) to get a listing of applications.
I'm not familiar with Macs at all, and my Linux experience is mostly user-end within academia.
So, my question is this: does anyone know a good cross-platform way to get the process-list?
My solution would be to use a package spec with a general function returning the list in the manner the Java expects it and throw together three different bodies for each of the platforms which would get the process-list according to that system and compile the (resultant) three binaries for those targets individually.
Is there a [good] way to do it w/o resorting to three different versions?
(This is an Ada question, but Java solutions are welcome.)
Java has no cross-platform API to list running processes. ProcessBuilder may be used to excecute the ps command, as shown here and here. The (rough) equivalent in Ada would be GNAT.Os_Lib.Spawn in GNAT. I'm not sure about other implementations.
JavaSysMon can provide a list of running processes (as well as other system information) in a platform-independent manner. Currently it supports Mac OS X, Linux, Windows, and Solaris. As an added bonus, it is BSD licensed.
Wiki
JavaDocs
You were almost at the Ada solution. As you only want 1 procedure to execute & look at the system call (top/ps in linux/unix) i would suggest a separate procedure. This will live in its own directory, and only be referenced by the correct compilation (per os). As for the actual commands per os, that is not part of my answer.
Do you just mean to get a list of running processes?
If so, you can just Google the commands to get this (1) the name of the OS on which the program is running, then (2) run Runtime.getRuntime.exec(stringCommandToGetProcessList); to based on #1, and output the results.
You don't need a different Java binary for every OS. You only need one. Just Google the command to find the OS name/version, and the command to get the list of running applications.
You also don't need JNI to do this. Use the Runtime class to run commands as if they were on the command-line.
There's no cross-platform way to do it, because the commands are different on each OS. But since there's only three major OS's (maybe a dozen total that you want to support, in some crazy extreme example), then it's just a matter of making a list of the 12 different commands to do this.
On Macs, and many Linux versions, OS name/version:
$ uname -a
Darwin normalocity 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7 16:32:41 PDT 2011; root:xnu-1504.15.3~1/RELEASE_X86_64 x86_64
Running processes (by highest usage):
$ top
Processes: 92 total, 5 running, 87 sleeping, 408 threads 20:38:35
Load Avg: 0.18, 0.20, 0.17 CPU usage: 7.26% user, 1.95% sys, 90.78% idle
SharedLibs: 6272K resident, 7300K data, 0B linkedit. MemRegions: 12204 total, 730M resident, 29M private, 393M shared.
PhysMem: 1076M wired, 1184M active, 1859M inactive, 4119M used, 4062M free.
VM: 207G vsize, 1041M framework vsize, 1851231(0) pageins, 603(0) pageouts.
Networks: packets: 1727104/1746M in, 984226/269M out. Disks: 295257/6745M read, 397634/15G written.
PID COMMAND %CPU TIME #TH #WQ #PORT #MRE RPRVT RSHRD RSIZE VPRVT VSIZE PGRP PPID STATE UID
12547 top 3.5 00:00.26 1/1 0 24 34 1208K 264K 1784K 17M 2378M 12547 12217 running 0
12217 bash 0.0 00:00.08 1 0 17 25 1328K 856K 1988K 17M 2378M 12217 12211 sleeping 502
12212 bash 0.0 00:00.08 1 0 17 25 1276K 856K 1980K 9688K 2378M 12212 12200 sleeping 502
12211 login 0.0 00:00.01 1 0 22 54 512K 312K 1648K 11M 2379M 12211 12196 sleeping 0
12202 bash 0.0 00:00.07 1 0 17 25 1276K 856K 1980K 9688K 2378M 12202 12199 sleeping 502
12201 bash 0.0 00:00.07 1 0 17 25 1276K 856K 1980K 9688K 2378M 12201 12198 sleeping 502
12200 login 0.0 00:00.01 1 0 22 54 512K 312K 1648K 11M 2379M 12200 12196 sleeping 0
12199 login 0.0 00:00.01 1 0 22 54 512K 312K 1648K 11M 2379M 12199 12196 sleeping 0
12198 login 0.0 00:00.01 1 0 22 54 512K 312K 1648K 11M 2379M 12198 12196 sleeping 0
12196 Terminal 33.9 00:01.84 5 1 114- 137 5736K+ 32M 23M+ 90M 2768M 12196 300 sleeping 502
11803- Google Chrom 0.0 04:06.79 7 1 99 365 45M 84M 79M 112M 1199M 11788 11788 sleeping 502
11800- Google Chrom 0.0 00:00.25 7 1 98 215 9632K 77M 23M 110M 1090M 11788 11788 sleeping 502
11799- Google Chrom 0.0 00:07.92 7 1 99 288 25M 82M 43M 109M 1108M 11788 11788 sleeping 502
11797- Google Chrom 0.0 00:01.49 7 1 99 316 27M 81M 48M 111M 1109M 11788 11788 sleeping 502
11796- Google Chrom 0.0 00:00.44 4 1 91 115 2824K 65M 8304K 96M 1012M 11788 11788 sleeping 502
11795- Google Chrom 0.0 00:00.96 7 1 98 215 9172K 77M 23M 111M 1091M 11788 11788 sleeping 502
11794- Google Chrom 0.0 00:07.64 8 1 100 294 20M 75M 36M 113M 1101M 11788 11788 sleeping 502
11793- Google Chrom 0.0 00:01.42 8 1 95 185 9732K 73M 24M 104M 1057M 11788 11788 sleeping 502
11788- Google Chrom 0.6 04:04.31 30 1 307 390 61M 110M 96M 254M 1298M 11788 300 sleeping 502
4328 ssh-agent 0.0 00:00.19 2 1 33 63 1300K 396K 2688K 59M 2420M 4328 300 sleeping 502
3855- Microsoft Of 0.0 00:36.14 4 1 121 337 12M 30M 22M 93M 1027M 3855 300 sleeping 502
492 AppleSpell 0.0 00:10.56 2 1 34 72 4608K 9028K 10M 88M 2469M 492 300 sleeping 502
Ada doesn't really have the concept of "processes" within the language. In fact, Ada code can run on platforms that do not support heavy processes at all (eg: Many smallish embedded platforms, like vxWorks).
That means you are going to have to use some kind of API (most likely supplied by your OS) to get that information.
If your OS supports POSIX, you may be able to use Posix bindings like Florist to get that info. There are full Unix subsystems available for Windows (Cygwin) and I believe MacOS is built on a flavor of Unix. So it might be possible to use Unix as sort of a lingua-franca so you can get your process info from a single (POSIX) API.
Now where Java is concerned, there are two issues: The Java language and the Java Platform (JVM). Java language fans like to conflate the two, but there are actually Ada compilers that target the JVM, and they can call all the same JVM API's that code written in the Java language can call. If there's one that allows Java programs to get a list of all the threads or processes that the JVM knows about, you could call that same routine from Ada too (if it is running under the JVM as well).

Categories