Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Registration without config download plus testapp and add-on changes. #4

Merged
merged 3 commits into from
Aug 18, 2011
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ Linux:
Built regularly on Ubuntu 10.4 32bit and 64bit
Third-Party Libraries
+libxml2 - sudo apt-get install libxml2-dev
+libcurl - sudo apt-get install libcurl4-openssl-dev
+Glib - sudo apt-get install libdbus-glib-1-dev
+asound - sudo apt-get install libasound2-dev
+libgtk - sudo apt-get install libgtk2.0-dev
Expand Down Expand Up @@ -93,23 +92,25 @@ There are two ways to use the Test Application
./tests/testapp_softphone/TestApp_SoftPhone

Enter SIP Server IP address
Enter SIP Server Username
Enter SIP Server Password
Enter SIP Server Username (phone DN)
Enter device name


Run the Test Application from the command line with a config file as a parameter
./tests/testapp_softphone/TestApp_SoftPhone cfg.txt
- Sample cfg.txt (create file named e.g. cfg.txt)

IP_ADDRESS=10.53.40.5
DEVICENAME=CSFemannion
DEVICENAME=emannionsip1
LOGFILE=local.log
LOCALIP=10.53.50.187
SIPUSER=1010

Notes
IP_ADDRESS = SIP server IP address
IP_ADDRESS = SIP server IP address, used as part of SIP AOR
DEVICENAME = name of device config file on SIP server
LOCALIP = IP address of local network adapter
SIPUSER = users DN configured on CUCM used as part of SIP AOR, i.e. SIPUSER@IP_ADDRESS

TestApp Commands
- ? -- view commands available
Expand Down
3 changes: 1 addition & 2 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ build_env = Environment()
build_env["CPPDEFINES"] = [
'LOG4CXX_STATIC',
'_NO_LOG4CXX',
'USE_SSLEAY',
'CURL_STATICLIB',
'USE_SSLEAY',
'LIBXML_STATIC',
'_CPR_USE_EXTERNAL_LOGGER'
]
Expand Down
10 changes: 5 additions & 5 deletions ikran/CallControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,16 +194,16 @@ void CallControl::OnCallConnected()
*/
NS_IMETHODIMP
CallControl::RegisterUser(
const char* user_name,
const char* user_password,
const char* user_device,
const char* user,
const char* proxy_address,
nsISessionStateObserver *obs
)
{
//copy the parameters
sessionObserver = obs;
m_user_name = const_cast<char*>(user_name);
m_user_password = const_cast<char*>(user_password);
m_user_device = const_cast<char*>(user_device);
m_user = const_cast<char*>(user);
m_proxy_address = const_cast<char*>(proxy_address);

if (m_registered) {
Expand All @@ -216,7 +216,7 @@ CallControl::RegisterUser(

//lets give it a shot
SipccController::GetInstance()->AddSipccControllerObserver(this);
int res = SipccController::GetInstance()->Register(m_user_name, m_user_password, m_proxy_address);
int res = SipccController::GetInstance()->Register(m_user_device, m_user, m_proxy_address);
if(res == 0) {
m_registered = PR_TRUE;
return NS_OK;
Expand Down
4 changes: 2 additions & 2 deletions ikran/CallControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ class CallControl : public ICallControl,


private:
char *m_user_name;
char *m_user_password;
char *m_user_device;
char *m_user;
char *m_proxy_address;
char *m_dial_number;
};
Expand Down
4 changes: 2 additions & 2 deletions ikran/ICallControl.idl
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ interface nsIMediaStateObserver : nsISupports
[scriptable, uuid(c467b1f4-551c-4e2f-a6ba-cb7d792d5244)]
interface ICallControl : nsISupports
{
void registerUser(in string user_name,
in string user_password,
void registerUser(in string user_device,
in string user,
in string proxy_address,
in nsISessionStateObserver sess_obs);
void unregisterUser();
Expand Down
4 changes: 1 addition & 3 deletions ikran/SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,7 @@ elif sys.platform=='darwin':
'crypto',
'apr-1',
'aprutil-1',
'z',
'curl',
'z',
'libxml2',
'iconv',
'X11',
Expand Down Expand Up @@ -288,7 +287,6 @@ elif sys.platform=='linux2':
'idn',
'dl',
'rt',
'curl',
'xml2',
'asound',
'Xext',
Expand Down
84 changes: 0 additions & 84 deletions ikran/content/example.html

This file was deleted.

4 changes: 2 additions & 2 deletions ikran/content/ikran.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ <h1>Ikran Example</h1>
Re = true;
regbut.value = "UnRegister !";
msg.innerHTML = "Atempting 2 Register...";
Me.registerUser("blah", "blah", "111.111.11.11", onSessionStateChange);
Me.registerUser("emannionsip01", "1000", "10.99.10.75", onSessionStateChange);
msg.innerHTML = "Registered...";
}
}
Expand All @@ -74,7 +74,7 @@ <h1>Ikran Example</h1>
// Start recording
ReRe = true;
msg.innerHTML = "Placing Call...";
Me.placeCall("1034", onMediaStateChange);
Me.placeCall("9991", onMediaStateChange);
callbut.value = "End Call!";
}
}
Expand Down
4 changes: 2 additions & 2 deletions ikran/content/ikran.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ Ikran.prototype = {
}
},

registerUser: function(user, password, proxy, obs) {
registerUser: function(user_device, user, proxy, obs) {
if (this._session)
throw "Session already in progress";

Expand All @@ -163,7 +163,7 @@ Ikran.prototype = {
else this._session_observer = function() {};

// Start rainbow session
this._ikran.registerUser(user, password, proxy, this._session_observer);
this._ikran.registerUser(user_device, user, proxy, this._session_observer);
this._session = true;
},

Expand Down
4 changes: 2 additions & 2 deletions ikran/content/injected.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ if (window && window.navigator) {
if (!window.navigator.service)
window.navigator.service = {};
window.navigator.service.call= {
registerUser: function(user_name, user_password, proxy_address, sess_obs) {
return regUser(window.location, user_name, user_password, proxy_address, sess_obs);
registerUser: function(user_device, user, proxy_address, sess_obs) {
return regUser(window.location, user_device, user, proxy_address, sess_obs);
},
placeCall: function(dn, media_obs) {
return callStart(window.location, dn, media_obs);
Expand Down
4 changes: 2 additions & 2 deletions ikran/content/injector.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ var IkranObserver = {
);
sandbox.window = subject.wrappedJSObject;

sandbox.importFunction(function(loc, user_name, user_password, proxy_address, sess_obs) {
sandbox.importFunction(function(loc, user_device, user, proxy_address, sess_obs) {
ikran._verifyPermission(window, loc, function(allowed) {
if (allowed) ikran.registerUser(user_name, user_password, proxy_address, sess_obs);
if (allowed) ikran.registerUser(user_device, user, proxy_address, sess_obs);
else throw "Permission denied";
});
}, "regUser");
Expand Down
53 changes: 14 additions & 39 deletions ikran/sipcc_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,49 +79,34 @@ void SipccController::InitInternal() {
ccm_ptr_ = CSF::CallControlManager::create();
ccm_ptr_->addCCObserver(this);
ccm_ptr_->addECCObserver(this);
ccm_ptr_->setCCMCIPServers(proxy_ip_address_);
ccm_ptr_->setTFTPServers(proxy_ip_address_);
ccm_ptr_->setLocalIpAddressAndGateway(local_ip_v4_address_,"");
//ccm_ptr_->setSIPCCLoggingMask( GSM_DEBUG_BIT | FIM_DEBUG_BIT | SIP_DEBUG_MSG_BIT | CC_APP_DEBUG_BIT | SIP_DEBUG_REG_STATE_BIT );
ccm_ptr_->setSIPCCLoggingMask(0);
LOG(ERROR)<<"SipccController:: Authentication user : " << aor_;
ccm_ptr_->setAuthenticationCredentials(aor_, user_credential_);

//Authenticate
if(ccm_ptr_->authenticate() != AuthenticationFailureCodeType::eNoError) {
initDone = false;
Logger::Instance()->logIt(" Authentication Failed ");
return;
} else {

}

LOG(ERROR)<<"SipccController:: Authentication user : " << sip_user_;
initDone = true;
}

bool SipccController::RegisterInternal() {

Logger::Instance()->logIt("RegisterInternal");
std::string deviceName;
std::string preferrdLine;
if(ccm_ptr_->connect(deviceName, preferrdLine) == false) {
Logger::Instance()->logIt("RegisterInternal - FAILED ");

if(ccm_ptr_->registerUser(device_, sip_user_, sip_domain_) == false) {
Logger::Instance()->logIt("RegisterInternal - FAILED ");
return false;
}
}

return true;

return true;
}

// API Functions
int SipccController::Register(std::string aor, std::string credentials, std::string proxy) {
int SipccController::Register(std::string device, std::string sipUser, std::string sipDomain) {
int result = 0;
aor_ = aor;
user_credential_ = credentials;
proxy_ip_address_ = proxy;
Logger::Instance()->logIt(aor_);
Logger::Instance()->logIt(user_credential_);
Logger::Instance()->logIt(proxy_ip_address_);
sip_user_ = sipUser;
device_ = device;
sip_domain_ = sipDomain;
Logger::Instance()->logIt(sip_user_);
Logger::Instance()->logIt(device_);
Logger::Instance()->logIt(sip_domain_);
GetLocalActiveInterfaceAddress();

InitInternal();
Expand All @@ -131,8 +116,6 @@ int SipccController::Register(std::string aor, std::string credentials, std::str
return result;
}



void SipccController::UnRegister() {
if (ccm_ptr_ != NULL) {
ccm_ptr_->disconnect();
Expand Down Expand Up @@ -194,12 +177,9 @@ Logger::Instance()->logIt(" In Asnwer call ");
#endif
} else {
}

}




// Device , Line Events notification handlers
void SipccController::onDeviceEvent (ccapi_device_event_e deviceEvent, CC_DevicePtr device, CC_DeviceInfoPtr info) {
}
Expand All @@ -210,7 +190,6 @@ void SipccController::onFeatureEvent (ccapi_device_event_e deviceEvent, CC_Devic
void SipccController::onLineEvent (ccapi_line_event_e lineEvent, CC_LinePtr line, CC_LineInfoPtr info) {
}


void SipccController::onAvailablePhoneEvent (AvailablePhoneEventType::AvailablePhoneEvent event,const PhoneDetailsPtr availablePhoneDetails)
{}

Expand All @@ -220,8 +199,6 @@ void SipccController::onAuthenticationStatusChange (AuthenticationStatusEnum::Au
//SipStack Callbacks for changes in call status.
void SipccController::onCallEvent (ccapi_call_event_e callEvent, CC_CallPtr call, CC_CallInfoPtr info)
{


if (callEvent == CCAPI_CALL_EV_STATE) {

if (info->getCallState() == RINGIN) {
Expand Down Expand Up @@ -253,7 +230,6 @@ void SipccController::onCallEvent (ccapi_call_event_e callEvent, CC_CallPtr call
observer_->OnCallConnected();
}
}

}

//SipStack Callbacks for changes in connection status.
Expand Down Expand Up @@ -325,7 +301,6 @@ CC_CallPtr SipccController::GetFirstCallWithCapability (CallControlManagerPtr cc
return NULL_PTR(CC_Call);
}


// POSIX Only Implementation
bool SipccController::GetLocalActiveInterfaceAddress()
{
Expand All @@ -334,7 +309,7 @@ bool SipccController::GetLocalActiveInterfaceAddress()
sock_desc_ = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
struct sockaddr_in proxy_server_client;
proxy_server_client.sin_family = AF_INET;
proxy_server_client.sin_addr.s_addr = inet_addr(proxy_ip_address_.c_str());
proxy_server_client.sin_addr.s_addr = inet_addr(sip_domain_.c_str());
proxy_server_client.sin_port = 12345;
fcntl(sock_desc_,F_SETFL, O_NONBLOCK);
int ret = connect(sock_desc_, reinterpret_cast<sockaddr*>(&proxy_server_client),
Expand Down
Loading