-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathTestSipUserAgent.cpp
More file actions
86 lines (64 loc) · 1.92 KB
/
TestSipUserAgent.cpp
File metadata and controls
86 lines (64 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#include "TestSipUserAgent.h"
#include "Log.h"
#include "CallBack.h"
int main( int argc, char * argv[] )
{
if( argc > 1 )
{
if( !strcmp( argv[1], "speed" ) )
{
TestStartCallSpeed( argc, argv );
return 0;
}
}
CLog::SetLevel( LOG_NETWORK | LOG_DEBUG );
CSipUserAgent clsUserAgent;
CSipStackSetup clsSetup;
CSipServerInfo clsServerInfo;
GetLocalIp( clsSetup.m_strLocalIp );
clsSetup.m_iLocalUdpPort = 5080;
//clsServerInfo.m_strUserId = "1000";
//clsServerInfo.m_strPassWord = "1234";
//clsServerInfo.m_strIp = "192.168.150.10";
//clsUserAgent.InsertRegisterInfo( clsServerInfo );
gclsCallBack.m_pclsSipUserAgent = &clsUserAgent;
if( clsUserAgent.Start( clsSetup, &gclsCallBack ) == false )
{
printf( "clsUserAgent.Start() error\n" );
return 0;
}
/*
CSipCallRtp clsRtp;
CSipCallRoute clsRoute;
std::string strCallId;
clsRtp.m_iCodec = 0;
clsRtp.m_strIp = clsSetup.m_strLocalIp;
clsRtp.m_iPort = 6000;
clsRoute.m_strDestIp = "192.168.0.1";
clsRoute.m_iDestPort = 5060;
if( clsUserAgent.StartCall( "1000", "1001", &clsRtp, &clsRoute, strCallId ) == false )
{
printf( "clsUserAgent.StartCall() error\n" );
return 0;
}
INVITE_TRANSACTION_MAP clsICTMap;
INVITE_TRANSACTION_MAP::iterator itTM;
char szPacket[2048];
memset( szPacket, 0, sizeof(szPacket) );
clsUserAgent.m_clsSipStack.GetICTMap( clsICTMap );
itTM = clsICTMap.begin();
CSipMessage * pclsResponse = itTM->second->m_pclsRequest->CreateResponse( SIP_OK );
pclsResponse->AddRecordRoute( "192.168.0.100", 5060 );
pclsResponse->AddRecordRoute( "192.168.0.200", 5060 );
pclsResponse->ToString( szPacket, sizeof(szPacket) );
printf( "[%s]\n", szPacket );
Socket hSocket = UdpSocket();
UdpSend( hSocket, szPacket, strlen(szPacket), clsSetup.m_strLocalIp.c_str(), clsSetup.m_iLocalUdpPort );
sleep(10);
*/
while( 1 )
{
sleep(1);
}
return 0;
}