Package org.asteriskjava.fastagi

Examples of org.asteriskjava.fastagi.AgiRequest


    @SuppressWarnings("deprecation")
    @Test
    public void testBuildRequest()
    {
        List<String> lines;
        AgiRequest request;

        lines = new ArrayList<String>();

        lines.add("agi_network: yes");
        lines.add("agi_network_script: myscript.agi");
        lines.add("agi_request: agi://host/myscript.agi");
        lines.add("agi_channel: SIP/1234-d715");
        lines.add("agi_language: en");
        lines.add("agi_type: SIP");
        lines.add("agi_uniqueid: 1110023416.6");
        lines.add("agi_callerid: John Doe<1234>");
        lines.add("agi_dnid: 8870");
        lines.add("agi_rdnis: 9876");
        lines.add("agi_context: local");
        lines.add("agi_extension: 8870");
        lines.add("agi_priority: 1");
        lines.add("agi_enhanced: 0.0");
        lines.add("agi_accountcode: ");

        request = new AgiRequestImpl(lines);

        assertEquals("incorrect script", "myscript.agi", request.getScript());
        assertEquals("incorrect requestURL", "agi://host/myscript.agi", request.getRequestURL());
        assertEquals("incorrect channel", "SIP/1234-d715", request.getChannel());
        assertEquals("incorrect uniqueId", "SIP/1234-d715", request.getChannel());
        assertEquals("incorrect type", "SIP", request.getType());
        assertEquals("incorrect uniqueId", "1110023416.6", request.getUniqueId());
        assertEquals("incorrect language", "en", request.getLanguage());
        assertEquals("incorrect callerId", "1234", request.getCallerId());
        assertEquals("incorrect callerIdName", "John Doe", request.getCallerIdName());
        assertEquals("incorrect dnid", "8870", request.getDnid());
        assertEquals("incorrect rdnis", "9876", request.getRdnis());
        assertEquals("incorrect context", "local", request.getContext());
        assertEquals("incorrect extension", "8870", request.getExtension());
        assertEquals("incorrect priority", new Integer(1), request.getPriority());
        assertEquals("incorrect enhanced", Boolean.FALSE, request.getEnhanced());
        assertNull("incorrect accountCode must not be set", request.getAccountCode());
    }
View Full Code Here


    @Test
    public void testBuildRequestWithAccountCode()
    {
        List<String> lines;
        AgiRequest request;

        lines = new ArrayList<String>();

        lines.add("agi_network: yes");
        lines.add("agi_network_script: myscript.agi");
        lines.add("agi_accountcode: 12345");

        request = new AgiRequestImpl(lines);

        assertEquals("incorrect accountCode", "12345", request.getAccountCode());
    }
View Full Code Here

    @SuppressWarnings("deprecation")
    @Test
    public void testBuildRequestWithoutCallerIdName()
    {
        List<String> lines;
        AgiRequest request;

        lines = new ArrayList<String>();

        lines.add("agi_callerid: 1234");

        request = new AgiRequestImpl(lines);

        assertEquals("incorrect callerId", "1234", request.getCallerId());
        assertEquals("incorrect callerIdNumber", "1234", request.getCallerIdNumber());
        // assertNull("callerIdName must not be set",
        // request.getCallerIdName());
    }
View Full Code Here

    @SuppressWarnings("deprecation")
    @Test
    public void testBuildRequestWithoutCallerIdNameButBracket()
    {
        List<String> lines;
        AgiRequest request;

        lines = new ArrayList<String>();

        lines.add("agi_callerid: <1234>");

        request = new AgiRequestImpl(lines);

        assertEquals("incorrect callerId", "1234", request.getCallerId());
        assertEquals("incorrect callerIdNumber", "1234", request.getCallerIdNumber());
        assertNull("callerIdName must not be set", request.getCallerIdName());
    }
View Full Code Here

    @SuppressWarnings("deprecation")
    @Test
    public void testBuildRequestWithoutCallerIdNameButBracketAndQuotesAndSpace()
    {
        List<String> lines;
        AgiRequest request;

        lines = new ArrayList<String>();

        lines.add("agi_callerid: \"\" <1234>");

        request = new AgiRequestImpl(lines);

        assertEquals("incorrect callerId", "1234", request.getCallerId());
        assertEquals("incorrect callerIdNumber", "1234", request.getCallerIdNumber());
        assertNull("callerIdName must not be set", request.getCallerIdName());
    }
View Full Code Here

    @SuppressWarnings("deprecation")
    @Test
    public void testBuildRequestWithQuotedCallerIdName()
    {
        List<String> lines;
        AgiRequest request;

        lines = new ArrayList<String>();

        lines.add("agi_callerid: \"John Doe\"<1234>");

        request = new AgiRequestImpl(lines);

        assertEquals("incorrect callerId", "1234", request.getCallerId());
        assertEquals("incorrect callerIdNumber", "1234", request.getCallerIdNumber());
        assertEquals("incorrect callerIdName", "John Doe", request.getCallerIdName());
    }
View Full Code Here

    @SuppressWarnings("deprecation")
    @Test
    public void testBuildRequestWithQuotedCallerIdNameAndSpace()
    {
        List<String> lines;
        AgiRequest request;

        lines = new ArrayList<String>();

        lines.add("agi_callerid: \"John Doe\" <1234>");

        request = new AgiRequestImpl(lines);

        assertEquals("incorrect callerId", "1234", request.getCallerId());
        assertEquals("incorrect callerIdNumber", "1234", request.getCallerIdNumber());
        assertEquals("incorrect callerIdName", "John Doe", request.getCallerIdName());
    }
View Full Code Here

    @SuppressWarnings("deprecation")
    @Test
    public void testBuildRequestWithoutCallerId()
    {
        List<String> lines;
        AgiRequest request;

        lines = new ArrayList<String>();

        lines.add("agi_callerid: ");

        request = new AgiRequestImpl(lines);

        assertNull("callerId must not be set", request.getCallerId());
        assertNull("callerIdNumber must not be set", request.getCallerIdNumber());
        assertNull("callerIdName must not be set", request.getCallerIdName());
    }
View Full Code Here

    @SuppressWarnings("deprecation")
    @Test
    public void testBuildRequestCallerIdAsterisk12()
    {
        List<String> lines;
        AgiRequest request;

        lines = new ArrayList<String>();

        lines.add("agi_callerid: 1234");
        lines.add("agi_calleridname: John Doe");

        request = new AgiRequestImpl(lines);

        assertEquals("incorrect callerId", "1234", request.getCallerId());
        assertEquals("incorrect callerIdNumber", "1234", request.getCallerIdNumber());
        assertEquals("incorrect callerIdName", "John Doe", request.getCallerIdName());
    }
View Full Code Here

    @SuppressWarnings("deprecation")
    @Test
    public void testBuildRequestCallerIdAsterisk12WithUnknownCallerId()
    {
        List<String> lines;
        AgiRequest request;

        lines = new ArrayList<String>();

        lines.add("agi_callerid: unknown");
        lines.add("agi_calleridname: John Doe");

        request = new AgiRequestImpl(lines);

        assertNull("callerId must not be set if \"unknown\"", request.getCallerId());
        assertNull("callerIdNumber must not be set if \"unknown\"", request.getCallerIdNumber());
        assertEquals("incorrect callerIdName", "John Doe", request.getCallerIdName());
    }
View Full Code Here

TOP

Related Classes of org.asteriskjava.fastagi.AgiRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.