#!/usr/bin/env python
'''
Copyright (C) 2011, Digium, Inc.
Richard Mudgett <rmudgett@digium.com>

This program is free software, distributed under the terms of
the GNU General Public License Version 2.
'''

import sys
import os

sys.path.append("lib/python")

from twisted.internet import reactor
from asterisk.sipp import SIPpTest


WORKING_DIR = "sip/message_unauth_from"
TEST_DIR = os.path.dirname(os.path.realpath(__file__))

SIPP_SCENARIOS = [
    # Start the receiver SIPp scenario's first
    # Match the scenarios below with the extensions.conf MessageSend() lines by port number.
    {
        'scenario' : 'message_recv_fred.xml',
        '-p' : '5062'
    },
    {
        'scenario' : 'message_recv_unknown.xml',
        '-p' : '5063'
    },
    {
        'scenario' : 'message_recv_default.xml',
        '-p' : '5064'
    },
    {
        'scenario' : 'message_recv_anonymous.xml',
        '-p' : '5065'
    },
    {
        'scenario' : 'message_recv_goober.xml',
        '-p' : '5066'
    },
    {
        'scenario' : 'message_recv_noname.xml',
        '-p' : '5067'
    },
    {
        'scenario' : 'message_recv_passed.xml',
        '-p' : '5068'
    },
    {
        'scenario' : 'message_recv_passed.xml',
        '-p' : '5069'
    },
    # Finally start the sending SIPp scenario that kicks everything off.
    {
        'scenario' : 'message.xml',
        '-p' : '5061'
    }
]


def main():
    test = SIPpTest(WORKING_DIR, TEST_DIR, SIPP_SCENARIOS)
    reactor.run()
    if not test.passed:
        return 1

    return 0


if __name__ == "__main__":
    sys.exit(main())


# vim:sw=4:ts=4:expandtab:textwidth=79
