Hello to all, i have created a sample program from documentation. My error is pjsua_acc.c 1. Unable to create/send Register : Object is busy [PJSIP_BUSY] 2. SIP Registratation failed status = 503, service unavailable My SIP account is PeterAPIIT at iptel.org and password is wlx_4046. Question: 1. What the cb structure does ? 2. What is Media State ? 3. What to do when my application make VOIP call behind a router or proxy ? University network. 4. What else i need to do in order to complete a simple VOIP application ? 5. How to redirect console output to file ? 6. What is credit count ? 7. What is realm and digest ? 8. What pjsua_acc_config does ? It is use to configure the SIP account in case i have several accounts. 9. Where pjsua_acc_add add the account to ? 10. What 200 represent in pjsua_call_answer(callID, 200, NULL, NULL); 11. What this function does ? void ResponseMediaState(pjsua_call_id callID) { pjsua_call_info callInfo; pjsua_call_get_info(callID, &callInfo); if (callInfo.media_status == PJSUA_CALL_MEDIA_ACTIVE) { // When media is active, connect call to sound device. pjsua_conf_connect(callInfo.conf_slot, 0); pjsua_conf_connect(0, callInfo.conf_slot); } } [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 LOGFILE "D:\\C++\\Test\\Log.txt" // What to do when Incoming Call void ResponseIncomingCall(pjsua_acc_id, pjsua_call_id, pjsip_rx_data*); // What to do when Media State change void ResponseMediaState(pjsua_call_id); // What to do when Call State change void ResponseCallState(pjsua_call_id, pjsip_event*); // ============================================= 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 config and pjsua Logging pjsua_config_default(&cfg); pjsua_logging_config_default(&logCfg); // cfg.stun_srv; cfg.cb.on_incoming_call = &ResponseIncomingCall; cfg.cb.on_call_media_state = &ResponseMediaState; cfg.cb.on_call_state = &ResponseCallState; cfg.hangup_forked_call = PJ_TRUE; logCfg.console_level = 2; logCfg.decor; // Initialize pjsua status = pjsua_init(&cfg, &logCfg, NULL); if (status != PJ_SUCCESS) { cout << "\nError Initialize pjsua"; } // 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); accountCfg.id = pj_str("sip:PeterAPIIT at iptel.org<sip%3APeterAPIIT at iptel.org> "); accountCfg.reg_uri = pj_str("sip:iptel.org"); accountCfg.cred_count = 1; accountCfg.cred_info[0].realm = pj_str("iptel.org"); accountCfg.cred_info[0].scheme = pj_str("digest"); accountCfg.cred_info[0].username = pj_str("Peter_APIIT"); accountCfg.cred_info[0].data_type = PJSIP_CRED_DATA_PLAIN_PASSWD; accountCfg.cred_info[0].data = pj_str("wlx_4046"); // Add Account status = pjsua_acc_add(&accountCfg, PJ_TRUE, &accID); if (status != PJ_SUCCESS) { cout << "\nError Adding VOIP Account"; } // Make Call pj_str_t SIPURL = pj_str("sip:*061600 at ekiga.net"); status = ::pjsua_call_make_call(accID, &SIPURL, 0, NULL, NULL, NULL); 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; } // ============================================= void ResponseIncomingCall(pjsua_acc_id accID, pjsua_call_id callID, pjsip_rx_data* rxData) { pjsua_call_info callInfo; PJ_UNUSED_ARG(accID); PJ_UNUSED_ARG(rxData); pjsua_call_get_info(callID, &callInfo); PJ_LOG(3,(LOGFILE, "Incoming call from %.*s!!", (int)callInfo.remote_info.slen, callInfo.remote_info.ptr)); pjsua_call_answer(callID, 200, NULL, NULL); } // ============================================= void ResponseMediaState(pjsua_call_id callID) { pjsua_call_info callInfo; pjsua_call_get_info(callID, &callInfo); if (callInfo.media_status == PJSUA_CALL_MEDIA_ACTIVE) { // When media is active, connect call to sound device. pjsua_conf_connect(callInfo.conf_slot, 0); pjsua_conf_connect(0, callInfo.conf_slot); } } // ============================================= void ResponseCallState(pjsua_call_id callID, pjsip_event* myEvent) { pjsua_call_info callInfo; PJ_UNUSED_ARG(myEvent); pjsua_call_get_info(callID, &callInfo); PJ_LOG(3,(LOGFILE, "Call %d state=%.*s", callID, (int)callInfo.state_text.slen, callInfo.state_text.ptr)); } [/code] Please help. Thanks. -- Linux -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20091006/f74ae574/attachment.html>