コード例 #1
0
def test_re_invite():
    params = {
        'alias': 'alias1',
        'rh': '172.30.3.155',
        'rp': 5060,
        'lh': '10.1.195.25',
        'lp': 5060,
        'transport': 'tcp',
    }

    sip.send_invite(params)
    res = sip.get_invite_response(params)
    if (res[0] > 299):
        sys.exit(1)
    sip.send_ack(params)
    print('in call...')
    time.sleep(1)
    sip.send_re_invite(params, sip.sdp2(params))
    res = sip.get_invite_response(params)
    sip.send_ack(params)
    if (res[0] == 200):
        sdp = res[2]
        p = media.gst(media.parse_sdp(sdp))
        time.sleep(30)
    p.kill()
    sip.send_bye(params)
    time.sleep(1)
コード例 #2
0
def test_call_media(params, duration):

    sip.send_invite(params)
    res = sip.get_invite_response(params)
    if (res[0] > 299):
        sys.exit(1)
    sip.send_ack(params)
    print('in call...')
    sdp = res[2]
    p = media.gst(media.parse_sdp(sdp))
    for t in range(duration):
        time.sleep(1)
        tick()
    p.kill()
    sip.send_bye(params)
    time.sleep(1)
コード例 #3
0
ファイル: test.py プロジェクト: obnauticus/tandbergProxy
def test_call_media():
    params = {
        'alias': 'test',
        'rh': '10.0.4.234',
        'rp': 5060,
        'lh': '10.0.4.43',
        'lp': 5060,
        'transport': 'tcp',
    }
    sip.send_invite(params)
    res = sip.get_invite_response(params)
    if (res[0] > 299):
        sys.exit(1)
    sip.send_ack(params)
    print('in call...')
    sdp = res[2]
    p = media.gst(media.parse_sdp(sdp))
    time.sleep(30)
    p.kill()
    sip.send_bye(params)
    time.sleep(1)
コード例 #4
0
def test_parse():
    params = {
        'alias': 'broadcast1',
        'rh': '10.1.195.217',
        'rp': 5060,
        'lh': '10.1.195.200',
        'lp': 5060,
        'transport': 'tcp',
        'branch': 'z9hG4bKwxCUIdAXzfF9ByGk3mNljD68S4TsHJRW',
        'local_tag': 'amrT5tq0Wekwn1iE',
        'call_id': '78b776d5-ec0a-4c25-b8a5-3a65f62d5acf'
    }

    i = sip.create_invite(params, sip.sdp(params))

    print(i)

    print("========sdp=======")
    print(sip.parse_message((i)[1]))

    print('media is {}'.format(media.parse_sdp(sip.parse_message(i)[1])))

    headers = sip.parse_message(i)[0]
    print("========headers=======")
    for header in headers:
        print(header)
        if 'To:' in header:
            to = header

    print("========tag=======")
    print(sip.get_tag(headers, "From:"))

    params['peer_tag'] = sip.get_tag(headers, "From:")
    a = sip.create_ack(params)

    print("========ack=======")
    print(a)