aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-04-04 18:39:56 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-04-04 18:39:56 +0200
commitfb83b7a86d1c2ed335f7f3c00782154854233677 (patch)
tree393d229f0a3f9aa1adaf97823b257446fbe853a9 /openbsc
parentef0b641f63ce78f3e2e85ab5c243d033a5504429 (diff)
[mgcp] Start to look into the MGCP messages and extract the CI
we will need the call identifier for the MDCX and DLCX message for now we were just assuming it would increment, use som python to extract the CI from a possible response, also switch back to a blocking read to test the BSC nat.
Diffstat (limited to 'openbsc')
-rwxr-xr-xopenbsc/contrib/mgcp_server.py28
1 files changed, 17 insertions, 11 deletions
diff --git a/openbsc/contrib/mgcp_server.py b/openbsc/contrib/mgcp_server.py
index 88963f31b..ae8a6e277 100755
--- a/openbsc/contrib/mgcp_server.py
+++ b/openbsc/contrib/mgcp_server.py
@@ -25,15 +25,24 @@ def hexdump(src, length=8):
server_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
server_socket.bind(("127.0.0.1", MGCP_CALLAGENT_PORT))
-server_socket.setblocking(0)
+server_socket.setblocking(1)
-
-def send_receive(packet):
+last_ci = 1
+def send_and_receive(packet):
+ global last_ci
server_socket.sendto(packet, ("127.0.0.1", MGCP_GATEWAY_PORT))
try:
data, addr = server_socket.recvfrom(4096)
+
+ # attempt to store the CI of the response
+ list = data.split("\n")
+ for item in list:
+ if item.startswith("I: "):
+ last_ci = int(item[3:])
+
print hexdump(data), addr
- except socket.error:
+ except socket.error, e:
+ print e
pass
def generate_tid():
@@ -42,13 +51,10 @@ def generate_tid():
-i = 1
while True:
- send_receive(rsip_resp)
- send_receive(audit_packet % generate_tid())
- send_receive(crcx_packet % generate_tid() )
- send_receive(mdcx_packet % (generate_tid(), i))
- send_receive(dlcx_packet % (generate_tid(), i))
- i = i + 1
+ send_and_receive(audit_packet % generate_tid())
+ send_and_receive(crcx_packet % generate_tid() )
+ send_and_receive(mdcx_packet % (generate_tid(), last_ci))
+ send_and_receive(dlcx_packet % (generate_tid(), last_ci))
time.sleep(3)