1 / 30

Setup oSIP and example

Setup oSIP and example. Speaker: Yi-Ji Jheng Date: 2007.11.07. Outline. Setup oSIP and example Setup eXoSIP and example Program - SIP_Call. Setup oSIP and example. Install libosip2. #tar zxvf libosip2-2.2.1.tar.gz #cd ./libosip2-2.2.1 #./configure #make #make install

aislinn
Télécharger la présentation

Setup oSIP and example

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Setup oSIP and example Speaker: Yi-Ji Jheng Date: 2007.11.07

  2. Outline • Setup oSIP and example • Setup eXoSIP and example • Program - SIP_Call

  3. Setup oSIP and example

  4. Install libosip2 • #tar zxvf libosip2-2.2.1.tar.gz • #cd ./libosip2-2.2.1 • #./configure • #make • #make install • Library default install in /usr/local/lib • libosip2 • osipparser2

  5. Make oSIP of example – via parser (1/3) • #cd ./src/test • #gcc tvia.c -o tvia * • #gcc tvia.c -o tvia -I../../include * • #gcc tvia.c -o tvia \ -I../../include \ -losipparser2 \ -L/usr/local/lib

  6. Make oSIP of example – via parser (2/3) • #./tvia * • #./tvia * • #./tvia ./res/vias.txt • Can see via of parser • To do another program if success

  7. Make oSIP of example – via parser (3/3) • Tips • Can make all oSIP of examples when install • #./configure --enable-test • #make • All include *.txt for program are in ./src/test/res

  8. SETUP EXOSIP AND EXAMPLE

  9. Install libexosip (1/2) • #tar zxvf libeXosip-0.9.0.tar.gz • #cd ./libeXosip-0.9.0 • #./configure --disable-phapi --disable-miniua --disable-josua --disable-glib --disable-ms --disable-ortp --disable-gsm --disable-ilbc *

  10. Install libexosip (2/2) • #make • #make install • Library default install in /usr/local/lib • libeXosip

  11. Make eXoSIP of example - Register (1/3) • #cd ./tools • #gcc sip_reg.c -o sip_reg -leXosip -L/usr/local/lib * • #./sip_reg *

  12. Make eXoSIP of example - Register (2/3) • #./sip_reg \ --proxy sip:<server ip> \ --from sip:<username>@<server ip> \ --contact sip:<username>@<ip> \ --port <port>\ --username <username> \ --password <password>

  13. Make eXoSIP of example - Register (3/3) • Tips • Program would run background • Use #serctl ul show to see success or not with SIP server • Can make this program when install • #./configure --enable-test • #make

  14. PROGRAM - SIP_CALL

  15. Make program of sip_call • #g++ test.cpp -o sip_call * • #g++ test.cpp -o sip_call * • #g++ test.cpp -o sip_call -leXosip -losip2 • /tmp/ccCRNT0p.o(.text+0x14): In function `__exit(int)': • : the `gets' function is dangerous and should not be used.

  16. Modify program of sip_call • #vi test.cpp • Debug mode • //FILE* logfile = fopen( "logfile.txt", "w"); • //osip_trace_initialize( (_trace_level)8, logfile ); • osip_trace_initialize( (_trace_level)8, stdout ); • For us • i = eXosip_build_initial_invite(&invite, "sip:<ip>:[port]", //to "sip:<ip>:[port]", //from NULL, "hello");

  17. Key options of sip_call • a - answering call • h – hangup call • r - ringing • c - call • q - quit

  18. Homework • Modify sip_call bug • If Sip_call is caller, it cannot hangup call • Sip_call cannot dial two times more • Marge sip_call and sip_reg to be a easy softphone

  19. REPLENISH

  20. Gcc example directly • error : tvia.c:28:28: osip2/internal.h: No such file or directory • #find / -name internal.h • /usr/src/osip/libosip2-2.2.1/include/osip2/internal.h

  21. No library support (1/2) • error : /tmp/cc1oGZ3o.o(.text+0x5b): In function `main': : undefined reference to `osip_malloc_func' . . . /tmp/cc1oGZ3o.o(.text+0x201): In function `main': : undefined reference to `osip_free_func' collect2: ld returned 1 exit status

  22. No library support (2/2) • Linker error • #gcc tvia.c -c -o tvia.o -I../../include • #ld tvia.o -o tvia –lc * • #ls -al /usr/local/lib • Which one to use (osip2 or osipparser2) • Look at program  parser via • #vi tvia.c

  23. Shared libraries • error : ./tvia: error while loading shared libraries: libosipparser2.so.3: cannot open shared object file: No such file or directory • #vi /etc/ld.so.conf • add : /usr/local/lib • #ldconfig

  24. Failed to open • error : Failed to open (null) file. Usage: tvia vias.txt • #find / -name vias.txt • /usr/src/osip/libosip2-2.2.1/src/test/res/vias.txt

  25. Other options • miniua : example • josua : example • phapi : softphone of button • glib : graphlib • ortp : rtp • ms : media streaming • ilbc : codec • gsm : codec

  26. Update lib of path • #ldconfig • #ldconfig -v • To see lib of path

  27. sip_reg of options • Complain no options • --proxy sip:proxyhost[:port] • --port • --from sip:proxyhost[:port] • --contact sip:proxyhost[:port] • --username • --password • --expiry

  28. VC vs. GCC (1/2) • test.cpp:23:20: stdafx.h: No such file or directory • test.cpp:29:19: conio.h: No such file or directory • test.cpp: In function `void __exit(int)': • test.cpp:103: `exit' undeclared (first use this function) • test.cpp:103: (Each undeclared identifier is reported only once for each function it appears in.) • test.cpp: In function `int main(int, char**)': • test.cpp:520: `_kbhit' undeclared (first use this function) • test.cpp:522: `_getch' undeclared (first use this function)

  29. VC vs. GCC (2/2) • #vi test.cpp • Comment stdafx.h and conio.h • Modify _getch() to getchar() • Delete if(_kbhit()){} • Include some header for osip • #include <stdio.h> • #include <stdlib.h> • #include <unistd.h> • #include <netdb.h> • #include <syslog.h> • #include <pthread.h>

  30. Linker error • /tmp/ccMdnyE9.o(.text+0x14): In function `__exit(int)': • : the `gets' function is dangerous and should not be used. • /tmp/ccMdnyE9.o(.text+0x56): In function `josua_event_get()': • : undefined reference to `eXosip_event_wait‘ • /tmp/ccMdnyE9.o(.gnu.linkonce.t._ZN5jcall5buildEP12eXosip_event+0xef): In function `jcall::build(eXosip_event*)': • : undefined reference to `osip_strncpy' • /tmp/ccMdnyE9.o(.gnu.linkonce.t._ZN5jcall5buildEP12eXosip_event+0x11a): more undefined references to `osip_strncpy' follow • collect2: ld returned 1 exit status

More Related