-
Notifications
You must be signed in to change notification settings - Fork 19
Examples
Augusto Campos edited this page Jul 1, 2022
·
13 revisions
[Dependencies]
sudo apt-get install liblog4cplus-dev libssl-dev libboost-thread-dev libboost-regex-dev
[Library Build]
(goto asteriskcpp base dir)
aclocal ; autoheader; automake -a -c; libtoolize --force --copy; autoconf;
autoconf; automake; ./configure
make
sudo make install
[Example 1]
//TesteCpp.cpp
#include <iostream>
#include "asteriskcpp/utils/LogHandler.h"
#include "asteriskcpp/manager/ManagerConnection.h"
using namespace asteriskcpp;
void eventCallback(ManagerEvent* me) {
std::cout << std::endl << "TEST:EVENT" << me->toLog() << std::endl;
}
int main() {
ManagerConnection mc;
mc.addEventCallback(&eventCallback); // add event listener
if (mc.connect("192.168.1.6")) {
if (mc.login("admin", "zzz")) {
mc.logoff();
}
}
mc.disconnect();
return (0);
}
[build example]
g++ Test.cpp -o tt -L/usr/local/lib/ -lasteriskcpp -lpthread