$ service freeswitch start
$ service turnserver start
$ tail -f /var/log/messages
import sys
import pjsua as pj
LOG_LEVEL=3
current_call = None
def log_cb(level, str, len):
print str,
class MyAccountCallback(pj.AccountCallback):
def __init__(self, account=None):
pj.AccountCallback.__init__(self, account)
def on_incoming_call(self, call):
global current_call
if current_call:
call.answer(486, "Busy")
return
print "Incoming call from ", call.info().remote_uri
print "Press 'a' to answer"
current_call = call
call_cb = MyCallCallback(current_call)
current_call.set_callback(call_cb)
current_call.answer(180)
class MyCallCallback(pj.CallCallback):
def __init__(self, call=None):
pj.CallCallback.__init__(self, call)
def on_state(self):
global current_call
print "Call with", self.call.info().remote_uri,
print "is", self.call.info().state_text,
print "last code =", self.call.info().last_code,
print "(" + self.call.info().last_reason + ")"
if self.call.info().state == pj.CallState.DISCONNECTED:
current_call = None
print 'Current call is', current_call
def on_media_state(self):
if self.call.info().media_state == pj.MediaState.ACTIVE:
call_slot = self.call.info().conf_slot
pj.Lib.instance().conf_connect(call_slot, 0)
pj.Lib.instance().conf_connect(0, call_slot)
print "Media is now active"
else:
print "Media is inactive"
def make_call(uri):
try:
print "Making call to", uri
return acc.make_call(uri, cb=MyCallCallback())
except pj.Error, e:
print "Exception: " + str(e)
return None
lib = pj.Lib()
try:
lib.init(log_cfg = pj.LogConfig(level=LOG_LEVEL, callback=log_cb))
transport = lib.create_transport(pj.TransportType.UDP, pj.TransportConfig(0))
print "\nListening on", transport.info().host,
print "port", transport.info().port, "\n"
lib.start()
# when no sound card found
lib.set_null_snd_dev()
#snd_dev = lib.get_snd_dev()
#print snd_dev ## returns (-1,-2)
#lib.set_snd_dev(0,0)
#acc = lib.create_account_for_transport(transport, cb=MyAccountCallback())
acc = lib.create_account(pj.AccountConfig("192.168.1.12", "1shamun", "admin2013"))
cb = MyAccountCallback(acc)
acc.set_callback(cb)
#cb.wait()
print "\n"
print "Registration complete, status=", acc.info().reg_status, \
"(" + acc.info().reg_reason + ")"
if len(sys.argv) > 1:
lck = lib.auto_lock()
current_call = make_call(sys.argv[1])
print 'Current call is', current_call
del lck
my_sip_uri = "sip:" + transport.info().host + \
":" + str(transport.info().port)
while True:
print "My SIP URI is", my_sip_uri
print "Menu: m=make call, h=hangup call, a=answer call, q=quit"
input = sys.stdin.readline().rstrip("\r\n")
if input == "m":
if current_call:
print "Already have another call"
continue
print "Enter destination URI to call: ",
input = sys.stdin.readline().rstrip("\r\n")
if input == "":
continue
lck = lib.auto_lock()
current_call = make_call(input)
del lck
elif input == "h":
if not current_call:
print "There is no call"
continue
current_call.hangup()
elif input == "a":
if not current_call:
print "There is no call"
continue
current_call.answer(200)
elif input == "q":
break
transport = None
acc.delete()
acc = None
lib.destroy()
lib = None
except pj.Error, e:
print "Exception: " + str(e)
lib.destroy()
lib = None
./pjturn-client-x86_64-unknown-linux-gnu --tcp 192.168.1.12:3478
The crash is not normal, of course.
It is saying "error 0" that means "no error".
I only see BINDING requests, that means that you are using only STUN, right ?
Do you have the wireshark traces of the communications between your client and the server ?
What exactly you are doing ? Can you send me the exact description how I reproduce it ?
Oleg
--
You received this message because you are subscribed to the Google Groups "TURN Server project rfc5766-turn-server" group.
To unsubscribe from this group and stop receiving emails from it, send an email to turn-server-project-rfc57...@googlegroups.com.
To post to this group, send email to turn-server-project...@googlegroups.com.
Visit this group at http://groups.google.com/group/turn-server-project-rfc5766-turn-server.
For more options, visit https://groups.google.com/groups/opt_out.
+=====================================================================+
| CLIENT | PEER-0 |
| | |
| State : Ready | Address: 192.168.1.15:46590 |
| Relay addr: 192.168.1.12:61471 | |
| | 0 Send data to relay address |
| a Allocate relay | |
| p,pp Set permission for peer 0/1 +--------------------------------+
| s,ss Send data to peer 0/1 | PEER-1 |
| b,bb BindChannel to peer 0/1 | |
| x Delete allocation | Address: 192.168.1.15:39407 |
+------------------------------------+ |
| q Quit d Dump | 1 Send data to relay adderss |
+------------------------------------+--------------------------------+
>>> 22:35:02.379 tcprel0x228f9f !.RX 56 bytes STUN message from 192.168.1.12:3478:
--- begin STUN message ---
STUN ChannelBind success response
Hdr: length=36, magic=2112a442, tsx_id=000071883352255a0216231e
Attributes:
SOFTWARE: length=32, value="Citrix-3.0.1.3 'Practical Frost'"
--- end of STUN message ---
22:35:02.379 stun_session.c .tdata 0x2292368 destroy request, force=0, tsx=0x2292520
22:35:02.379 utsx0x2292520 .STUN transaction 0x2292520 schedule destroy
22:35:02.683 utsx0x2292520 STUN client transaction 0x2292520 stopped, ref_cnt=6
22:35:02.683 stun_session.c STUN transaction 0x2292520 destroyed
Nov 28 00:52:32 localhost turnserver: 2213: TURN full connection closed, user <>
Nov 28 00:52:32 localhost turnserver: 2213: TURN full connection closed, user <>
Nov 28 00:52:39 localhost turnserver: 2221: IPv4. tcp or tls connected to: 192.168.1.15:36121
Nov 28 00:52:39 localhost turnserver: 2221: IPv4. Server relay addr: 192.168.1.12:0
Nov 28 00:52:39 localhost turnserver: 2221: IPv4. Local relay addr: 192.168.1.12:58605
Nov 28 00:52:39 localhost turnserver: 2221: new Allocation: id=0x753ad8ad, username=<>, lifetime=600
Nov 28 00:52:39 localhost turnserver: 2221: handle_turn_command: user <>: request ALLOCATE processed, error 0
Nov 28 00:52:46 localhost turnserver: 2227: TURN full connection closed, user <>
Nov 28 00:52:46 localhost turnserver: 2227: TURN full connection closed, user <>
Nov 28 00:52:54 localhost turnserver: 2235: handle_turn_command: user <>: request CREATE_PERMISSION processed, error 0
Nov 28 00:53:39 localhost turnserver: 2280: handle_turn_command: user <>: request CREATE_PERMISSION processed, error 0
Nov 28 00:53:43 localhost turnserver: 2284: handle_turn_command: user <>: request CREATE_PERMISSION processed, error 0
Nov 28 00:53:46 localhost turnserver: 2287: handle_turn_command: user <>: request CREATE_PERMISSION processed, error 0
Nov 28 00:53:48 localhost turnserver: 2289: handle_turn_command: user <>: request CREATE_PERMISSION processed, error 0
Nov 28 00:53:54 localhost turnserver: 2295: handle_turn_command: user <>: request CHANNEL_BIND processed, error 0
Nov 28 00:53:56 localhost turnserver: 2297: handle_turn_command: user <>: request CHANNEL_BIND processed, error 0
Nov 28 00:53:59 localhost turnserver: 2300: handle_turn_command: user <>: request CHANNEL_BIND processed, error 0
Nov 28 00:54:00 localhost turnserver: 2301: handle_turn_command: user <>: request CHANNEL_BIND processed, error 0
Nov 28 00:54:01 localhost turnserver: 2302: handle_turn_command: user <>: request CHANNEL_BIND processed, error 0
Nov 28 00:54:02 localhost turnserver: 2303: handle_turn_command: user <>: request CHANNEL_BIND processed, error 0
Nov 28 00:54:03 localhost turnserver: 2304: handle_turn_command: user <>: request CHANNEL_BIND processed, error 0
Nov 28 00:54:04 localhost turnserver: 2305: handle_turn_command: user <>: request CHANNEL_BIND processed, error 0
Nov 28 00:54:06 localhost turnserver: 2307: handle_turn_command: user <>: request CHANNEL_BIND processed, error 0
Nov 28 00:54:07 localhost turnserver: 2308: handle_turn_command: user <>: request CHANNEL_BIND processed, error 0
Nov 28 00:54:08 localhost turnserver: 2309: handle_turn_command: user <>: request CHANNEL_BIND processed, error 0
Nov 28 00:54:09 localhost turnserver: 2310: handle_turn_command: user <>: request CHANNEL_BIND processed, error 0
Nov 28 00:54:10 localhost turnserver: 2311: handle_turn_command: user <>: request CHANNEL_BIND processed, error 0
Nov 28 00:54:13 localhost turnserver: 2314: handle_turn_command: user <>: request CHANNEL_BIND processed, error 0
Nov 28 00:54:15 localhost turnserver: 2316: handle_turn_command: user <>: request CHANNEL_BIND processed, error 0
Nov 28 00:54:37 localhost turnserver: 2338: refreshed Allocation: id=0x753ad8ad, username=<>, lifetime=0
Nov 28 00:54:37 localhost turnserver: 2338: handle_turn_command: user <>: request REFRESH processed, error 0
Nov 28 00:54:37 localhost turnserver: 2338: TURN full connection closed, user <>
Nov 28 00:54:45 localhost turnserver: 2346: IPv4. tcp or tls connected to: 192.168.1.15:60330
Nov 28 00:54:45 localhost turnserver: 2346: IPv4. Server relay addr: 192.168.1.12:0
Nov 28 00:54:45 localhost turnserver: 2346: IPv4. Local relay addr: 192.168.1.12:64422
Nov 28 00:54:45 localhost turnserver: 2346: new Allocation: id=0x8d3ad8ad, username=<>, lifetime=600
Nov 28 00:54:45 localhost turnserver: 2346: handle_turn_command: user <>: request ALLOCATE processed, error 0
Nov 28 00:54:56 localhost turnserver: 2357: refreshed Allocation: id=0x8d3ad8ad, username=<>, lifetime=0
Nov 28 00:54:56 localhost turnserver: 2357: handle_turn_command: user <>: request REFRESH processed, error 0
Nov 28 00:54:56 localhost turnserver: 2357: TURN full connection closed, user <>
Nov 28 00:55:02 localhost turnserver: 2363: IPv4. tcp or tls connected to: 192.168.1.15:40504
Nov 28 00:55:02 localhost turnserver: 2363: IPv4. Server relay addr: 192.168.1.12:0
Nov 28 00:55:02 localhost turnserver: 2363: IPv4. Local relay addr: 192.168.1.12:58132
Nov 28 00:55:02 localhost turnserver: 2363: new Allocation: id=0x8d37d90d, username=<>, lifetime=600
Nov 28 00:55:02 localhost turnserver: 2363: handle_turn_command: user <>: request ALLOCATE processed, error 0
Nov 28 00:55:20 localhost turnserver: 2381: handle_turn_command: user <>: request CREATE_PERMISSION processed, error 0
Nov 28 00:55:31 localhost turnserver: 2392: refreshed Allocation: id=0x8d37d90d, username=<>, lifetime=0
Nov 28 00:55:31 localhost turnserver: 2392: handle_turn_command: user <>: request REFRESH processed, error 0
Nov 28 00:55:31 localhost turnserver: 2392: TURN full connection closed, user <>
Nov 28 00:56:11 localhost turnserver: 2432: handle_udp_packet: New UDP endpoint: local addr 192.168.1.12:3478, remote addr 192.168.1.15:46590
Nov 28 00:56:11 localhost turnserver: 2432: handle_turn_command: user <>: request BINDING processed, error 0
Nov 28 00:56:11 localhost turnserver: 2432: handle_udp_packet: New UDP endpoint: local addr 192.168.1.12:3478, remote addr 192.168.1.15:39407
Nov 28 00:56:11 localhost turnserver: 2432: handle_turn_command: user <>: request BINDING processed, error 0
Nov 28 00:56:37 localhost turnserver: 2458: IPv4. tcp or tls connected to: 192.168.1.15:52467
Nov 28 00:56:37 localhost turnserver: 2458: IPv4. Server relay addr: 192.168.1.12:0
Nov 28 00:56:37 localhost turnserver: 2458: IPv4. Local relay addr: 192.168.1.12:61471
Nov 28 00:56:37 localhost turnserver: 2458: new Allocation: id=0x713ad8ad, username=<>, lifetime=600
Nov 28 00:56:37 localhost turnserver: 2458: handle_turn_command: user <>: request ALLOCATE processed, error 0
Nov 28 00:56:50 localhost turnserver: 2472: handle_turn_command: user <>: request CREATE_PERMISSION processed, error 0
Nov 28 00:57:00 localhost turnserver: 2481: handle_turn_command: user <>: request CHANNEL_BIND processed, error 0
Nov 28 00:57:04 localhost turnserver: 2485: handle_turn_command: user <>: request CHANNEL_BIND processed, error 0
Nov 28 00:57:11 localhost turnserver: 2492: TURN full connection closed, user <>
Nov 28 00:57:11 localhost turnserver: 2492: TURN full connection closed, user <>
Nov 28 00:58:38 localhost turnserver: 2579: refreshed Allocation: id=0x713ad8ad, username=<>, lifetime=0
Nov 28 00:58:38 localhost turnserver: 2579: handle_turn_command: user <>: request REFRESH processed, error 0
Nov 28 00:58:38 localhost turnserver: 2579: TURN full connection closed, user <>
To unsubscribe from this group and stop receiving emails from it, send an email to turn-server-project-rfc5766-turn-server+unsubscribe@googlegroups.com.
To post to this group, send email to turn-server-project-rfc5766-turn-...@googlegroups.com.
...