Documente Academic
Documente Profesional
Documente Cultură
Version 1.0
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 1
Yeastar Technology Co., Ltd.
4. SIP .................................................................................................. 24
4.1 SIP protocol brief introduction ............................................................................. 24
4.2 SIP message .......................................................................................................... 25
4.3 Headers of SIP messages ...................................................................................... 30
4.4 SIP Example session.............................................................................................. 31
4.5 SIP Debug.............................................................................................................. 32
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 2
Yeastar Technology Co., Ltd.
MyPBX is uClinux based, users can login to the CLI (Command Line Interface) via SSH.
Before users can login, SSH should be enabled on network settings page.
Step 1 Enable SSH on network settings page.
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 3
Yeastar Technology Co., Ltd.
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 4
Yeastar Technology Co., Ltd.
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 5
Yeastar Technology Co., Ltd.
After enter asterisk CLI, we can execute some commands to check the channel status,
configure debug level and get further logs and so on. Below are some frequently used
Asterisk Commands:
Table 2 Asterisk commands
command Description Remark
asterisk enter asterisk CLI
–vvvvvr
core show - Display information on active channels
channels
dahdi show – Show active dahdi channels
channels
pri show spans - Displays PRI Information
pri set debug -Enables PRI debugging on a span pri set debug 2
{on|off|0|1|2} span 1
sip show peers - List defined SIP peers
sip set debug - Enable/Disable SIP debugging sip set debug ip
{on|off|ip} 192.168.5.100
Step 1: Login via ssh to enter MyPBX CLI and change the scroll lines of the putty window
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 6
Yeastar Technology Co., Ltd.
Step 3: Copy the logs and paste them into a txt file
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 7
Yeastar Technology Co., Ltd.
2. Analog telephony
2.1 Basic knowledge of the dial tone, ring back tone, busy tone, and
caller ID signal
Table 4 Tones
Tone Description Sound &
Waveform
Dial tone A dial tone (known in the British Isles as a diallingAnalog
tone) is a telephony signal used to indicate that Telephony\tones
the telephone exchange is working, has recognized \US_dial_tone.o
an off-hook, and is ready to accept a call. The tone gg
stops when the first numeral is dialed.
Ring back A ringback tone (or ringing tone) is an audible Analog
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 8
Yeastar Technology Co., Ltd.
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 9
Yeastar Technology Co., Ltd.
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 10
Yeastar Technology Co., Ltd.
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 11
Yeastar Technology Co., Ltd.
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 12
Yeastar Technology Co., Ltd.
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 13
Yeastar Technology Co., Ltd.
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 14
Yeastar Technology Co., Ltd.
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 15
Yeastar Technology Co., Ltd.
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 16
Yeastar Technology Co., Ltd.
3. BRI/PRI telephony
ISDN-BRI
Basic Rate Interface (BRI, 2B+D, 2B1D) is an Integrated Services Digital Network (ISDN)
configuration intended primarily for use in subscriber lines similar to those that have long
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 17
Yeastar Technology Co., Ltd.
been used for plain old telephone service. The BRI configuration provides 2 bearer
channels (B channels) at 64 kbit/s each and 1 data channel (D channel) at 16 kbit/s. The B
channels are used for voice or user data, and the D channel is used for any combination
of data, control/signalling, and X.25 packet networking. The 2 B channels can be
aggregated by channel bonding providing a total data rate of 128 kbit/s. The BRI ISDN
service is commonly installed for residential or small business service (ISDN PABX) in
many countries.
In contrast to the BRI, the Primary Rate Interface (PRI) configuration provides more B
channels and operates at a higher bit rate.
ISDN-PRI
The Primary Rate Interface (PRI) is a standardized telecommunications service level
within the Integrated Services Digital Network (ISDN) specification for carrying multiple
DS0 voice and data transmissions between a network and a user.
PRI is the standard for providing telecommunication services to offices. It is based on the
T-carrier (T1) line in the US and Canada, and the E-carrier (E1) line in Europe. The T1 line
consists of 24 channels, while an E1 has 31.
At the physical layer the ITU has defined the user network interface standard as I.430 for
Basic Rate Access and I.431 for Primary Rate Access; please see the ITU-T I.414
“Overview of Recommendations on Layer 1 for ISDN and B-ISDN customer accesses”
document on the ITU's website. ANSI has defined the user network interface standard as
T1.601. As already stated above, the physical layer uses the normal telephone cabling as
its physical cabling structure.
The ISDN B channels will typically utilize a Point-to-Point protocol such as HDLC
(High-Level Data Link Control) or PPP frames at Layer 2 however you can sometimes see
other encapsulation such as Frame relay. As you would expect, at layer 3 you typically see
IP packets. ISDN operates in Full-Duplex which means that traffic can be received and
transmitted at the same time.
The ISDN D channel will utilize different signalling protocols at Layer 3 and Layer 2 of the
OSI Model. Typically at Layer 2, LAP-D (Link Access Procedure – D Channel) is the Q.921
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 18
Yeastar Technology Co., Ltd.
signalling used and DSS1 (Digital Subscriber Signalling System No.1) is the Q.931
signalling that is used at Layer 3. It is easy to remember which one is used at which layer
by simply remembering that the middle number corresponds to the layer it operates at.
As part of the ISDN Standards, there are several types devices that are used to connect to
the ISDN network which are known as Terminal Equipments (TE) and also Network
Termination (NT) equipment. You also have Reference Points which are used to define
the connections between the various equipment that is used within the ISDN network.
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 19
Yeastar Technology Co., Ltd.
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 20
Yeastar Technology Co., Ltd.
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 21
Yeastar Technology Co., Ltd.
Table 9 PRI settings
Settings Comments Remark
·Signaling PRI-NET Depends on the
PRI-CPE other end of the
MFC/R2 trunk, for
SS7 example,
the other end is
PRI-NET, this
setting should be
configured as
PRI-CPE
.Mode Type E1 / T1 / J1 Depends on
which country
are you in
·Switch Type National: National ISDN type2 (common in the Depends on
US) which country
ni1: National ISDN type 1 are you in and
dms100: Nortel DMS100 the other end of
4ess: AT&T 4ESS the trunk
5ess: Lucent 5ESS
euroisdn: EuroISDN
qsig: D-channel signaling protocol at Q
reference point for PBX networking.
.CallerID When there are calls coming in via this BRI trunk, Optional setting
Prefix the CallerID Prefix you have set here will be
added before the CID.
·DOD Direct Outward Dialing Number. Usually, DOD is If not
related to DID. configured, you
might have
outgoing call
issues
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 22
Yeastar Technology Co., Ltd.
1. PRI include 3 layers, before we can make a call through PRI, we need to make sure first
two layers work normally. Layer 1 indicates physical connection while layer 2 indicates
the synchronization between MyPBX and the E1 provider.
Table 11 PRI line status
Connect Alarm Comment
The port hasn’t connected the E1 line.
E1 line has connected, PRI is in corresponding or can’t
communicate (synchronize).
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 23
Yeastar Technology Co., Ltd.
Succeed.
2. Debug commands under asterisk CLI:
under asterisk CLI, you can check layer 1 with command:
dahdi show status
Description Alarms IRQ bpviol CRC4 Fra Codi Options LBO
RED 0 0 0 CCS AMI YEL 0 db
OK 0 0 0 CCS AMI YEL 0 db
OK means layer 1 connected successfully. RED means disconnected.
under asterisk CLI, you can check layer 2 with command:
pri show spans
PRI span 1/0: Provisioned, Up, Active
PRI span 2/0: Provisioned, Down, Active
Up means layer 2 synchronize correctly, Down means synchronize fail.
4. SIP
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 24
Yeastar Technology Co., Ltd.
session which has been established in other ways.
3. Adopting transaction mechanism and operation method of each request triggers the
Server. A request and a response constitute a transaction, the transactions are
independent of each other.
4. Using textual encoding and decoding.
5. It’s based on the SMTP and HTTP protocols.
6. SIP protocol is only responsible for setting up the call (Signalling) only.
SIP does not describe and transfer the multimedia information. To complete the call, you
also need the help of two protocols:
1. SDP(Session Description Protocol) is responsible for setting the media attribute.
For example, setting the session port (port) and encoding (codec)
2. RTP (Real-time Transport Protocol)is the voice in a call or the video in a video call.
SRTP(Secure RTP) Since RTP can be intercepted and decoded easily by any network
capture. SRTP uses AES as encryption to protect the voice.
RFC(Request for Comments) :
SIP - RFC 3261 (There are many extended SIP RFC, and the functions are increasing
now.)
SDP - RFC 4566
RTP - RFC 3550
SRTP - RFC 3711
SIP is a text-based protocol and uses the UTF-8 charset A SIP message is either a
request from a client to a server, or a response from a server to a client.
Request: A SIP message sent from a client to a server, for the purpose of invoking a
particular operation.
Response: A SIP message sent from a server to a client, for indicating the status of a
request sent from the client to the server.
Transaction
SIP is a transactional protocol: interactions between components take place in a series of
independent message exchanges. Specifically, a SIP transaction consists of a single
request and any responses to that request, which include zero or more provisional
responses and one or more final responses. In the case of a transaction where the
request was an INVITE (known as an INVITE transaction), the transaction also includes
the ACK only if the final response was not a 2xx response. If the response was a 2xx, the
ACK is not considered part of the transaction. We can use branch to identify different
transaction.
Dialog
Dialog: A dialog is a peer-to-peer SIP relationship between two UAs that persists for some
time. A dialog is established by SIP messages, such as a 2xx response to an INVITE
request. A dialog is identified by a call identifier, local tag, and a remote tag. A dialog was
formerly known as a call leg in RFC 2543. We can use Call-ID to indentify different dialog.
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 25
Yeastar Technology Co., Ltd.
SIP requests are distinguished by having a Request-Line for a start line. A Request-Line
contains a method name, a Request-URI, and the protocol version separated by a single
space (SP) character.
The Request-Line ends with CRLF. No CR or LF are allowed except in the end-of-line CRLF
sequence. No linear whitespace (LWS) is allowed in any of the elements.
Method: This specification defines six methods: REGISTER for registering contact
information, INVITE, ACK, and CANCEL for
setting up sessions, BYE for terminating sessions, and OPTIONS for querying servers
about their capabilities. SIP extensions, documented in standards track RFCs, may define
additional methods.
Request-URI: The Request-URI is a SIP or SIPS URI or a general URI (RFC 2396 [5]). It
indicates the user or service to which this request is being addressed. The Request-URI
MUST NOT contain unescaped spaces or control characters and MUST NOT be enclosed
in "<>“. SIP elements MAY support Request-URIs with schemes other than "sip" and
"sips", for example the "tel" URI scheme of RFC2806 [9]. SIP elements MAY translate
non-SIP URIs using any mechanism at their disposal, resulting in SIP URI, SIPS URI, or
some other scheme.
SIP-Version: Both request and response messages include the version of SIP in use, and
follow [H3.1] (with HTTP replaced by SIP, and HTTP/1.1 replaced by SIP/2.0) regarding
version ordering, compliance requirements, and upgrading of version numbers. To be
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 26
Yeastar Technology Co., Ltd.
compliant with this specification, applications sending SIP messages MUST include a
SIP-Version of "SIP/2.0". The SIP-Version string is case-insensitive, but implementations
MUST send upper-case. Unlike HTTP/1.1, SIP treats the version number as a literal string.
In practice, this should make no difference.
Table 13 SIP request method
Request
The meaning of the message
message
Cancel the uncompleted request, the completed request (ie receive a final
CANCEL
response for the request) is not affected
REGISTER Register
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 27
Yeastar Technology Co., Ltd.
Example Request Message:
REGISTER sip:192.168.5.139 SIP/2.0
Via: SIP/2.0/UDP 192.168.4.16:5029;branch=z9hG4bK273563898
From: "502" <sip:502@192.168.5.139>;tag=1411642056
To: "502" <sip:502@192.168.5.139>
Call-ID: 143870753@192.168.4.16
CSeq: 2301 REGISTER
Contact: <sip:502@192.168.4.16:5029>
Authorization: Digest username="502", realm="asterisk", nonce="3a156c7a",
uri="sip:192.168.5.139", response="1ffdb7809cda0624100a0524af26944c",
algorithm=MD5
Allow: INVITE, INFO, PRACK, ACK, BYE, CANCEL, OPTIONS, NOTIFY, REGISTER, SUBSCRIBE,
REFER, PUBLISH, UPDATE, MESSAGE
Max-Forwards: 70
User-Agent: Yealink SIP-T28P 2.50.0.50
Proxy-Require: com.nortelnetworks.firewall
Expires: 300
Mac: 001565111886
Line: 4
Content-Length: 0
SIP responses are distinguished from requests by having a Status-Line as their start-line.
A Status-Line consists of the protocol version followed by a numeric Status-Code and its
associated textual phrase, with each element separated by a single SP character. No CR or
LF is allowed except in the final CRLF sequence.
The Status-Code is a 3-digit integer result code that indicates the outcome of an attempt
to understand and satisfy a request. The Reason-Phrase is intended to give a short textual
description of the Status-Code. The Status-Code is intended for use by automata,
whereas the Reason-Phrase is intended for the human user. A client is not required to
examine or display the Reason-Phrase. While this specification suggests specific wording
for the reason phrase, implementations MAY choose other text, for example, in the
language indicated in the Accept-Language header field of the request.
The first digit of the Status-Code defines the class of response.The last two digits do not
have any categorization role. For this reason, any response with a status code between
100 and 199 is referred to as a "1xx response", any response with a status code between
200 and 299 as a "2xx response", and so on. SIP/2.0 allows six values for the first digit:
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 28
Yeastar Technology Co., Ltd.
Table 15 Response status-codes
Serial
Status code Message capability
number
request received, continuing to process the
1xx Provisional
request
the action was successfully received,
2xx Success
understood, and accepted
further action needs to be taken in order to
3xx Redirection
complete the request
1. The Via header field indicates the transport used for the transaction and identifies the
location where the response is to be sent. A Via header field value is added only after the
transport that will be used to reach the next hop has been selected
2. The From header field indicates the logical identity of the initiator of the request,
possibly the user’s address-of-record. Like the To header field, it contains a URI and
optionally a display name. It is used by SIP elements to determine which processing rules
to apply to a request (for example, automatic call rejection). As such, it is very important
that the From URI not contain IP addresses or the FQDN of the host on which the UA is
running, since these are not logical names.
3. The To header field first and foremost specifies the desired "logical" recipient of the
request, or the address-of-record of the user or resource that is the target of this request.
This may or may not be the ultimate recipient of the request. The To header field MAY
contain a SIP or SIPS URI, but it may also make use of other URI schemes (the tel URL
(RFC 2806 [9]), for example) when appropriate. All SIP implementations MUST support
the SIP URI scheme. Any implementation that supports TLS MUST support the SIPS URI
scheme. The To header field allows for a display name.
4. The Call-ID header field acts as a unique identifier to group together a series of
messages. It MUST be the same for all requests and responses sent by either UA in a
dialog. It SHOULD be the same in each registration from a UA.
5. The CSeq header field serves as a way to identify and order transactions. It consists of
a sequence number and a method. The method MUST match that of the request. For
non-REGISTER requests outside of a dialog, the sequence number value is arbitrary. The
sequence number value MUST be expressible as a 32-bit unsigned integer and MUST be
less than 2**31. As long as it follows the above guidelines, a client may use any
mechanism it would like to select CSeq header field values.
6. The Max-Forwards header field serves to limit the number of hops a request can
transit on the way to its destination. It consists of an integer that is decremented by one
at each hop. If the Max-Forwards value reaches 0 before the request reaches its
destination, it will be rejected with a 483(Too Many Hops) error response.
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 30
Yeastar Technology Co., Ltd.
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 31
Yeastar Technology Co., Ltd.
After login via ssh, execute asterisk –vvvvvvvr to enter asterisk CLI. After enter asterisk,
we can execute
sip set debug on to enable sip debug for all active peers
sip set debug ip x.x.x.x to enable sip debug for specific IP address
sip set debug off to disable sip debug
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 32
Yeastar Technology Co., Ltd.
4.5.2 Wireshark
Usually, wireshark is used to debug for softphone. We can connect MyPBX and PC with a
hub, then all the packets go through MyPBX will be possibly captured by wireshark.
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 33
Yeastar Technology Co., Ltd.
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 34
Yeastar Technology Co., Ltd.
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 35
Yeastar Technology Co., Ltd.
cp revaliases revaliases_test
Step 4: execute below command
ssmtp -vt </etc/ssmtp/test.eml
Step 1 Enable SMS to email and email to SMS, test the SMTP and POP3 settings
Step 2 Login via ssh to MyPBX's CLI
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 36
Yeastar Technology Co., Ltd.
When system cannot start up, you will get the result: RUN status light is no blinking, fail
to access via web or SSH, and couldn’t get ping response from MyPBX. This probably
happens after firmware upgrade. For some abnormal reasons, power failure during
firmware upgrade for example, the onboard image may be damaged. At this moment
system fails to start up. Users will need a special program cable to recover the system.
Please take below guide for reference:
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 37
Yeastar Technology Co., Ltd.
6.1.1 Connection
Before connecting RS232 to MyPBX device, please make sure that the power is turned
off.
1)MyPBX-Standard
PC
PC
Figure 6-2 Connect RS232 interface 3 pin mode for MyPBX SOHO
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 38
Yeastar Technology Co., Ltd.
PC
Figure 6-3 Connect RS232 interface 10 pin mode for MyPBX SOHO
3)MyPBX-E1
MyPBX-E1 owns two kinds of RS232 interfaces; you can use one of them to
connect.
PC
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 39
Yeastar Technology Co., Ltd.
PC
4) MyPBX Enterprise
Figure 6-6 Connect console line with MyPBX Enterprise console port and PC
6.1.2 Terminal
Please use the putty (windows) or minicom (Linux) to connect with MyPBX.
Below are the detailed settings:
Speed:57600
Parity:none
Data: 8
Stopbits:1
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 40
Yeastar Technology Co., Ltd.
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 41
Yeastar Technology Co., Ltd.
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 42
Yeastar Technology Co., Ltd.
power on.
Note: Please execute nand erase to erase all incorrect configurations before write the
image to onboard flash.
Step 9. Upload image from network
If you found you cannot enter anything, please enter 111111 quickly when system
starts up.
yeastar> tftp 0x1000000 homepbx.ext2
dm9000 i/o: 0x20100300, id: 0x90000a46
MAC: 00:15:65:11:35:40
operating at 100M full duplex mode
TFTP from server 192.168.1.100; our IP address is 192.168.1.99
Filename 'homepbx.ext2'.
Load address: 0x1000000
Loading:
#####################################################
############
#####################################################
############
done
Bytes transferred = 9051452 (8a1d3c hex)
yeastar> re
Step 12 Finish
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 43
Yeastar Technology Co., Ltd.
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 44
Yeastar Technology Co., Ltd.
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 45
Yeastar Technology Co., Ltd.
Note: Please execute nand erase to erase all incorrect configurations before write the
image to onboard flash.
Step 9. Upload image from network
#####################################################
############
done
Bytes transferred = 9051452 (8a1d3c hex)
yeastar> re
Step 12 Finish
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 47
Yeastar Technology Co., Ltd.
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 48
Yeastar Technology Co., Ltd.
Click Open, you should see the picture below
Connection Ready.
Step 7. Get ready of TFTP server and uImage.ext2 (the file we send to you may in this
format with version number: 10.13.0.115.ext2, please replace uImage.ext2 to
10.13.0.115.ext2).
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 49
Yeastar Technology Co., Ltd.
Step 8. Change the default TFTP server (assume your TFTP server ip is 192.168.1.10) and
default ip address(get one available ip for ubbot ,take 192.168.1.99 for example) of uboot,
you can use printenv to check the server ip and ipaddr of uboot.
Note: Do not copy/paste the commands.
Note: Please execute nand erase 0 0x4000000 to erase all incorrect configurations before
write the image to onboard flash.
Step 9. Upload image from network
#################################################################
done
Bytes transferred = 19878938 (12f541a hex)
Pbx300> re
Step 12 Finish
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 50