Android Network phone source code

Source: Internet
Author: User

1. sipdroid \ SRC \ org \ zoolu is the implementation of the SIP protocol stack.

2. sipdroid \ SRC \ org \ sipdroid is the implementation of softphone

3. Implementation related to stun in sipdroid \ SRC \ com

4. sipdroid the default encoding format is G711-A rate.

5. The program compiled directly using ant debug supports only the-rate and U-Rate Audio Encoding formats. Other programs must be imported using the ndk method before they can be used.

6. If the peer terminal supports videos (such as Linphone), the menu is as follows:

Keep, mute,

Transfer and send video HANGS UP

Note: Only videos can be sent, and videos at the peer end cannot be received.

7. If the peer terminal does not support videos (such as Yate), the menu is as follows:

Keep, mute,

Transfer hanging up

8. videocamera. Java in sipdroid \ SRC \ org \ sipdroid \ sipua \ UI provides video capturing, sending, and receiving implementations.

9. video_menu_item in callscreen. Java in sipdroid \ SRC \ org \ sipdroid \ sipua \ UI identifies "Send video"

10. activity2.java implements jump to incallscreen. Java

11. Class incallscreenextends callscreen

12. sipdroid. Java has the "about exit Settings" menu implementation.

In androidmanifest. XML,

<Intent-filter>

<Actionandroid: Name = "android. Intent. Action. Main"/>

<Categoryandroid: Name = "android. Intent. Category. launcher"/>

</Intent-filter>

Indicates which activity is started first.

13. Audio Data transmitted from the network is played through the audiotrack class.

14. The local audio data is recorded through the audiorecord class.

15. You can extract the bitmap before displaying the video stream in the local video packet. The system does not provide any method for direct playback.

16. Thread Synchronization Method-synchronized

17. The icon in F: \ sipdroid \ res \ drawable can be changed.

18. sipdroid \ res \ values-ZH-RCN modify the content of the [about] display box

19

In the sipdroid open-source project, the sendmessage of sipprovider is used to send data on the server, because the connection is UDP, TCP, and message encapsulation.

20.

It is a connectionless package delivery service. Why is there no connection? the client and server have not established a connection at all. The server only opens a port to accept the data. If yes, the server accepts the data, no.

21. When you watch videos on both sides, you still need to go through the datagram package. You just need the IP address and port of the datagram package.

22. However, sipdroid can directly extract h264/h263 data from the generated video data in mediarecord. The data has been encoded accordingly.

23 how to watch the video:

Mvideoframe. setvideouri (URI. parse ("rtsp: //" + javaser. Engine (mcontext). getremoteaddr () + "/" +

Receiver. Engine (mcontext). getremotevideo () + "/sipdroid "));

24. The built-in videoview is used for playing through RTSP. That is to say, the server encapsulates the transmitted RTP video data stream into the RTSP stream and passes it to the videoview of the mobile phone for viewing, you also do not need to decode the database,

Therefore, only the sound encoding library is available in the sipdroid open source code, and no video encoding library is available.

25

The best way to implement this software is to extract h263/h264 data in real time using Android mediarecorder and then pass it to the RTSP server through RTP encapsulation. This is the best implementation method, you can get the preview frame encoding by getting onprewframe. No matter how you get it, it's inevitable, it's time-consuming, and it's tricky to lose frames.








2. sipdroid Process Analysis:

Dial-Up: the dial-up request is sent to sipdroidengine by the UI through the Referer broadcast information. The sipdroidengine performs some verification and then handed over to useragine for processing. Here, call (string target_url, Boolean send_anonymous) creates an extendedcall object for the SIP protocol stack to determine whether anonymous dialing is used in this method, and then calls the call method of extendedcall for processing, then, the call of extendedcall calls extendedinvitedialog to send the invite request. Invitedialog executes the specific invite to call the Request Method of invitetransactionclient. Finally, invitetransactionclient sends the request. In invitetransactionclient, messages are sent through sipprovider and port listening is enabled, to receive SIP messages. The main types of messages to be sent are:
Udptransport TCP transmission tcptransport)

Incoming call: when the program is started, a provider will be created through sipdroidengine according to the configuration. UDP transmission is used here to create a udpprovider. udpprover is a thread and the thread will be started when the program is created, start listening for received information. When the received information is received, the object is transferred to udptransport through the onserviceterminated method, which is processed by udptransport and then transmitted to the sipprovider object through the ontransportterminated method, finally, the received message is processed in the processreceivedmessage method of sipprovider. Finally, the corresponding listener is retrieved from listeners (MAP), and the specific SIP request is processed through onreceivemessage () in the corresponding listener.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.