2
* Copyright (C) 2004-2012 Savoir-Faire Linux Inc.
2
* Copyright (C) 2004-2013 Savoir-Faire Linux Inc.
3
3
* Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
5
5
* This program is free software; you can redistribute it and/or modify
366
367
CPPUNIT_ASSERT(foo == "17771234567");
370
void SIPTest::testParseDisplayName()
372
// 1st element is input, 2nd is expected output
373
const char *test_set[][2] = {
374
{"\nFrom: \"A. G. Bell\" <sip:agb@bell-telephone.com> ;tag=a48s", "A. G. Bell"},
375
{"\nFrom: \"A. G. Bell2\" <sip:agb@bell-telephone.com> ;tag=a48s\r\nOtherLine: \"bla\"\r\n", "A. G. Bell2"},
376
{"\nf: Anonymous <sip:c8oqz84zk7z@privacy.org>;tag=hyh8", "Anonymous"},
377
{"\nFrom: \"Alejandro Perez\" <sip:1111@10.0.0.1>;tag=3a7516a63bdbo0", "Alejandro Perez"},
378
{"\nFrom: \"Malformed <sip:1111@10.0.0.1>;tag=3a6a63bdbo0", ""},
379
{"\nTo: <sip:1955@10.0.0.1>;tag=as6fbade41", ""},
380
{"\nFrom: \"1000\" <sip:1000@sip.example.es>;tag=as775338f3", "1000"},
381
{"\nFrom: 1111_9532323 <sip:1111_9532323@sip.example.es>;tag=caa3a61", "1111_9532323"},
382
{"\nFrom: \"4444_953111111\" <sip:4444_111111@sip.example.es>;tag=2b00632co0", "4444_953111111"},
383
{"\nFrom: <sip:6926666@4.4.4.4>;tag=4421-D9700", ""},
384
{"\nFrom: <sip:pinger@sipwise.local>;tag=01f516a4", ""},
385
{"\nFrom: sip:pinger@sipwise.local;tag=01f516a4", ""},
386
{"\nFrom: sip:+1212555@server.example.com;tag=887s", ""}};
388
for (const auto &t : test_set) {
389
const std::string str(sip_utils::parseDisplayName(t[0]));
390
CPPUNIT_ASSERT(str == t[1]);
370
394
void SIPTest::testIncomingIpCallSdp()