Transferred from: http://www.wuleilei.com/blog/327
Most recent projects use VOIP,VOIP full voice over Internet Protocol, called VoIP, which is often used in life, such as Skype.
Can use the iphone above the VoIP library is not many, the first ready to use Lipphone, but its compilation is too slow, compiled n times did not succeed, finally gave up. Later try to use Pjsip, incredibly successful, a simple record of the process, in fact, according to the official website operation:)
First, environmental needs:
The iphone app is recommended for use with SDK 4.x, 3.x is supported, and the ipad app only supports SDK 3.2.
Second, before compiling the preparation work:
1, download Pjsip source code;
2, in the directory/pjsip/pjlib/include/pj/new config_site.h, paste the following code in:
?
| 12 |
#define PJ_CONFIG_IPHONE 1#<a href="http://www.wuleilei.com/blog/327">include</a> <pj/config_site_sample.h> |
Third, compile Pjsip:
Run the following command in the terminal:
?
| 123 |
$ cd /path/to/your/pjsip/$ ./configure-iphone$ <a href="http://www.wuleilei.com/blog/327">make</a> dep && make clean && make |
Iv. Compile the Pjsip library for the simulator:
Run the following command in the terminal:
?
| 1234 |
export DEVPATH=/Developer/Platforms/iPhoneSimulator.platform/Developerexport CC=/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.0CFLAGS="-O2 -m32 -miphoneos-version-min=4.0"LDFLAGS="-O2 -m32"./configure-iphonemake dep && make <a href="http://www.wuleilei.com/blog/327">clean</a> && make |
Compilation of Sample:
Compile the items in the directory Pjproject/pjsip-apps/src/ipjsua, if the above steps are successful, this is where you can see the main interface of the app.
Six, Test call:
1. Build a VoIP server:
There are many free SIP servers on the Internet, I use Minisipserver free version, installation is very simple, according to the interface prompts the next step is OK. Don't forget to create a new account after installation (for example, 100 and 101).
2. Install the VoIP client:
This is also a lot, I use the 3CX Phone Client. Login to account 100.
3. Login to account in the iphone's PJSIP Interface 101:
?
| 123456 |
< Code class= "AS3 Plain" >+a your SIP URL: (Empty to cancel): SIP: 101 @ 192.168 1.1 url of the Registrar: (Empty to cancel): sip: 192.168 1.1 auth Realm: (Empty to cancel): * <a href= "http://www.wuleilei.com/blog/327" >auth</a> Username: (Empty to cancel): 101 auth Password: (Empty to cancel): 123456 |
and 100 Call:
?
| 1234 |
+bEnter buddy‘s URI: (empty to cancel): sip:100@192.168.1.1mMake call: 1 |
The phone operation can also be simplified:
?
| 12 |
mMake call: <a href="http://www.wuleilei.com/blog/327">sip</a>:sip:100@192.168.1.1 |
At this time, you hear the phone ringing you are not very excited about it!
iOS development uses PJSIP to develop VoIP applications