[pjsip] Pjsua Sample Application Error From Creating Media Transport
Wong Peter
peterapiit at gmail.com
Sun Oct 4 04:22:54 CDT 2009
Hello to all, i have try to code a simple pjsua application.
I encounter error during execution of pjsua_start();
Please help
Thanks.
[code]
#include <iostream>
#include <pjsua-lib/pjsua.h>
using namespace std;
// Extra Include
/*#include <pjlib.h>
#include <pjlib-util.h>
#include <pjnath.h>
#include <pjsip.h>
#include <pjsip_ua.h>
#include <pjsip_simple.h>
#include <pjmedia.h>
#include <pjmedia-codec.h>*/
// =============================================
/*
Define PJ_WIN32 = 1 in project settings
Preprocessor Definition/Macro
http://trac.pjsip.org/repos/wiki/Getting-Started/Windows#Next:Usingpjprojectlibrariesforyourownapplication
http://trac.pjsip.org/repos/wiki/Getting-Started/Installing-OpenSSL-Windows
wsock.lib // Window Socket Library
ws_32.lib // Window Socket 2 Library
*/
// =============================================
// =============================================
int main()
{
pjsua_acc_id accID = 0;
pj_status_t status;
// Initialize pjlib library
status = pjsua_create();
if (status != PJ_SUCCESS)
{
cout << "Error Creating Pjsua socket";
}
pjsua_config cfg;
pjsua_logging_config logCfg;
// Init pjsua and Logging
pjsua_config_default(&cfg);
pjsua_logging_config_default(&logCfg);
// cfg.stun_srv;
logCfg.console_level = 4;
logCfg.decor;
// To set VOIP transport Mode -UDP/TCP/TLS/SCTP
pjsua_transport_config transportCfg;
pjsua_transport_config_default(&transportCfg);
transportCfg.port = 5060;
status = pjsua_transport_create(PJSIP_TRANSPORT_UDP, &transportCfg, 0);
if (status != PJ_SUCCESS)
{
cout << "Error Creating Pjsua transport mode";
}
// Start Pjsua
status = pjsua_start();
if (status != PJ_SUCCESS)
{
cout << "\nError start pjsua\n\n";
}
// Register SIP Account
pjsua_acc_config accountCfg;
pjsua_acc_config_default(&accountCfg);
// Make Call
pj_str_t SIPURL = pj_str("sip:*061600 at ekiga.net");
status = ::pjsua_call_make_call(accID, &SIPURL, 0, 0, 0, 0);
if (status != PJ_SUCCESS)
{
cout << "Error VOIP Call";
}
// Destroy pjlib library
// Unregister SIP account, Hang up call, Terminate presence subscription
status = pjsua_destroy();
if (status != PJ_SUCCESS)
{
cout << "Error destroy application library";
}
return 0;
}
// =============================================
// =============================================
// =============================================
[/code]
--
Linux
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20091004/916d4b4f/attachment.html>
More information about the pjsip
mailing list