Sunteți pe pagina 1din 50

Yeastar Technology Co., Ltd.

Troubleshooting Background Knowledge

Version 1.0

Date: July 12th, 2012

Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 1
Yeastar Technology Co., Ltd.

1. Command line interface ................................................................... 3


1.1 How to login command line interface .................................................................... 3
1.2 Frequently used Linux commands.......................................................................... 5
1.3 Frequently used asterisk commands ...................................................................... 6
1.4 How to get further logs .......................................................................................... 6

2. Analog telephony ............................................................................. 8


2.1 To know the dial tone, ring back tone, busy tone, and caller ID signal .................. 8
2.2 How to setup caller ID settings? ........................................................................... 10
2.3 How to setup busy detection settings .................................................................. 13

3. BRI/PRI telephony .......................................................................... 17


3.1 ISDN BRI/PRI brief introduction ........................................................................... 17
3.2 ISDN layers, components...................................................................................... 18
3.3 Configure BRI/PRI Settings on MyPBX .................................................................. 20
3.4 Pinout of BRI and PRI port .................................................................................... 23
3.5 PRI debug.............................................................................................................. 23

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

5. Other debug methods .................................................................... 35


5.1 SMTP debug.......................................................................................................... 35
5.2 Email SMS debug .................................................................................................. 36

6. How to recover system through program cable .............................. 37


6.1 Connect the program cable .................................................................................. 38
6.2 Recover system for MyPBX SOHO using program cable....................................... 41
6.3 Recover system for MyPBX Standard using program cable.................................. 44
6.4 Recover system for MyPBX Enterprise using program cable................................ 46

Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 2
Yeastar Technology Co., Ltd.

1. Command line interface

1.1 How to login command line interface

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.

Figure 1-1 Enable SSH


Step 2 Login via SSH, default username is root and password is ys123456

Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 3
Yeastar Technology Co., Ltd.

Figure 1-2 Login via SSH

Figure 1-3 Login As

Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 4
Yeastar Technology Co., Ltd.

Figure 1-4 Change a password for the CLI

1.2 Frequently used Linux commands

Table 1 Linux commands


Command Description Example
cat - combine, copy standard input to a stand Cat /home/osver
output. Used to join or display files
cd - change working directory. Cd /persistent
cp - copies on or more files
df - displays capacity and free capacity on different df
physical devices such as hard drive partitions and
floppy drives that are mounted on the file system.
dmesg - displays messages from /var/log relative to the dmesg
most recent boot
free - gives used and free memory on system along free
with other useful information
ifconfig - display (as root) information on network ifconfig
interfaces that are currently active.
ls - list directory contents. ls
mv - moves (renames) files
passwd - change login password passwd
ping - check if Internet computer is responding. Ping 192.168.5.1
ps - displays status of processes. ps

Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 5
Yeastar Technology Co., Ltd.

1.3 Frequently used asterisk commands

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

Rtp set debug -Enable/Disable RTP debugging rtp set debug on


{on|off}

1.4 How to get further logs

Step 1: Login via ssh to enter MyPBX CLI and change the scroll lines of the putty window

Figure 1-5 Change settings for putty

Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 6
Yeastar Technology Co., Ltd.

Figure 1-6 Change “Lines of scrollback” setting to a larger value


Step 2: Execute below commands to print and collect useful information
Table 3 Execute Commands
command information Remark
dmesg Hardware information
free Memory usage information
df Disk usage information
cpu CPU usage information
cat Memory block usage information
/proc/buddyinfo
asterisk -vvvvvr Enter asterisk CLI and get real time logs Enter asterisk
CLI
sip set debug on Enable SIP debugging Enable SIP
debugging only
when it is a SIP
related issue

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.

Figure 1-7 Copy all to clipboard

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.

tone indication that is heard on the telephone line by Telephony\tones


/ Ringing the caller while the phone they are calling is being \UK_ringback_to
tone rung. It is normally a repeated tone, designed to ne.ogg
assure the calling party that the called party's line
is ringing, although the ring-back tone may be out
of sync with the ringing signal
Busy tone A busy tone (or busy signal or engaged tone) in Analog
telephony is an audible or visual signal to the Telephony\tones
calling party that indicates failure to complete the \NorthAmerican
requested connection of that particular telephone BusySignal.ogg
call.
There are several distinctly different types of busy
signals:
1. A reorder tone, (sometimes called a fast busy
signal), indicates that no transmission path to the
called number is available;
2. An otherwise unspecified busy signal indicates
that the called number is occupied or otherwise
unavailable;
3. This tone sometimes occurs at the end of a call
to indicate the other party has hung up.
Polarity
Reversal
Caller ID Caller ID (caller identification, CID), also called
calling line identification (CLID), calling number
delivery (CND), calling number identification
(CNID) or calling line identification presentation
(CLIP), is a telephone service, available in analog
and digital phone systems and most voice over
Internet Protocol (VoIP) applications, that
transmits a caller's number to the called party's
telephone equipment during the ringing signal, or
when the call is being set up but before the call is
answered. Where available, caller ID can also
provide a name associated with the calling
telephone number. The information made
available to the called party may be displayed on a
telephone's display, on a separately attached
device, or be processed by an attached computer
with appropriate interface hardware.
CallerID-DT
MF
Caller ID-FSK

Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 9
Yeastar Technology Co., Ltd.

2.2 How to set up caller ID settings?

The caller id issues often happen on PSTN trunks.


Step 1 Make sure the CLIP of the PSTN line has been enabled. We can check this by
connecting a desktop analog phone to the PSTN line directly and make a call in to check if
the caller ID can be detect correctly.
Step 2 Try below settings on the PSTN trunk page, if no luck, please go to step 3.
Table 5 CallerID settings
Caller ID start caller ID signaling Remark
Ring US-Bell USA, China, Canada, Spain,
Singapore and most
countries in the world
Before Ring DTMF Often used in Taiwan,
Switzerland and so on
Note: If the caller ID
signaling is not DTMF but
configured as DTMF in
MyPBX, you will fail to call
in.
Polarity V23-uk Mostly used in England
Polarity V23-JP Used in Japan only
Step 3 Follow below guide to get the caller ID details
1 Login MyPBX CLI via ssh;
2 Go to directory /persistent/ (cd /persistent);
3 Execute command dahdi_monitor n –r rx.raw, n is channel number, for example, if you
want to monitor channel 1’s caller id signaling, the command is dahdi_monitor 1 –r
rx.raw;
4 Call in to the PSTN line, wait for 5 seconds, hang up the call, call in to the same PSTN
line again, wait for 5 seconds, then type Ctrl + c to stop the command;
5 Login via ftp and get the file /persistent/rx.raw
6 Use Cool Edit Pro (a kind of software) to check the caller id signal waveform;
Open the rx.raw file as
Sample Rate 8000
Channels Mono
Resolution 16-bit
Formatted the rx.raw file as 16-bit Intel PCM (LSB, MSB)

Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 10
Yeastar Technology Co., Ltd.

Figure 2-1 Sample format as

Figure 2-2 Data formatted as


7 Examples of CallerID signal waveform

Figure 2-3 FSK after first ring


(Caller id signaling: US Bell FSK Caller ID start: Ring )

Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 11
Yeastar Technology Co., Ltd.

Figure 2-4 V23-UK FSK after Polarity


(CallerID signaling: v23-uk CallerID start: Polarity)

Figure 2-5 DTMF before Ring


(Caller ID signaling: DTMF Caller ID start: Before RING)

Table 6 DTMF keypad frequencies


1209 Hz 1336 Hz 1477 Hz 1633 Hz
697 Hz 1 2 3 A
770 Hz 4 5 6 B
852 Hz 7 8 9 C
941 Hz * 0 # D

Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 12
Yeastar Technology Co., Ltd.

2.3 How to set up busy detection settings

Step 1 Try with the default settings


Step 2 Use the dahdi_monitor to get the busy tone detail
1 Login MyPBX CLI via ssh;
2 Go to directory /persistent/ (cd /persistent);
3 Execute command dahdi_monitor n –r rx.raw, n is channel number, for example, if you
want to monitor channel 1’s caller id signaling, command is dahdi_monitor 1 –r rx.raw;
4 Call in to the PSTN line, wait for 5 seconds, hang up the call, wait for 5 seconds, call in
to the same PSTN line again, wait for 5 seconds, then type Ctrl + c to stop the command;
5 Login via ftp and get the file /persistent/rx.raw
Step 3 Use Cool Edit(a kind of software) to analyze the busy tone detail
Open the rx.raw file as
Sample Rate 8000
Channels Mono
Resolution 16-bit
Formatted the rx.raw file as 16-bit Intel PCM ( LSB, MSB)

Figure 2-6 Sample Format As

Figure 2-7 Raw data


Example busy tone signal waveform
Usually, the length of the sound (on time) and the silence (off time) of busy tone are the
same. In below example, one cycle of the busy tone is 250 ms on, 250 ms off.

Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 13
Yeastar Technology Co., Ltd.

Figure 2-8 Busy Tone type 1


In below example, one cycle busy tone is 210 ms on, 210 ms off, 210 ms on, 210 ms off,
210 ms on, 210 ms off 630 ms on, 210 off.

Figure 2-9 busy tone type 2

Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 14
Yeastar Technology Co., Ltd.

Figure 2-10 Busy tone type 3

Figure 2-11 Polarity Reversal signal


Step 4 Setup correct settings on PSTN trunk page

Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 15
Yeastar Technology Co., Ltd.

Figure 2-12 Busy detection settings for busy tone type 1

Figure 2-13 Busy Detection settings for busy tone type 2

Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 16
Yeastar Technology Co., Ltd.

Figure 2-14 Busy Detection settings for busy tone type 3

Figure 2-15 Busy Detection settings for Polarity Reversal

3. BRI/PRI telephony

3.1 Brief introduction of ISDN BRI/PRI

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.

3.2 ISDN layers, components

ISDN uses circuit-switching to establish a physical permanent point-to-point connection


from the source to the destination. ISDN has standards defined by the ITU that
encompass the OSI bottom three layers of which are Physical, Data Link and Network, see
Table 7 below.
Table 7 ISDN Layers
OSI layer B channel D channel
3 Network Layer IP DSS1(Q.931)
2 Data Link Layer HDLC/PPP LAP-D(Q.921)
1 Physical Layer I.430/I.41 ANSI T1.601

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.

The Different ISDN Components

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.

Figure 3-1 ISDN components

Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 19
Yeastar Technology Co., Ltd.

3.3 Configure BRI/PRI Settings on MyPBX

3.3.1 BRI settings

Figure 3-2 BRI settings


Table 8 BRI settings
Settings Comments Remark
·Signaling Signaling method Depends on the
BRI-CPE: ISDN BRI in TE mode and Point to Point.
other end of the
BRI-CPE-PTMP: ISDN BRI in TE mode and Point to
trunk, for
multi Point. example, the
BRI-NET: ISDN BRI in NET mode and Point to other end is
Point. BRI-NET-PTMP,
BRI-NET-PTMP: ISDN BRI in NET mode and Pointthis setting
to multi Point. should be
configured as
BRI-CPE-PTMP
·Switch Type National: National ISDN type2 (common in the Depends on

Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 20
Yeastar Technology Co., Ltd.

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

3.3.2 PRI settings

Figure 3-3 PRI settings

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

3.3.3 Typical connections

Figure 3-4 MyPBX Act as TE1 or NT2(CPE or NET)

Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 22
Yeastar Technology Co., Ltd.

Figure 3-5 MyPBX act as gateway

3.4 Pinout of BRI and PRI port

Table 10 Pinout of BRI and PRI port


Port Picture Pinout Description Remark
BRI 1 No in use 1 No in use MyPBX Provides
2 TE Tx + 2 NT Rx + RJ11 BRI interface,
3 TE Rx + 3 NT Tx + support for both TE
4 TE Rx – 4 NT Tx – and NT mode.
5 TE Tx – 5 NT Rx –
6 No in use 6 No in use
BRI 1 No in use 1 No in use NeoGate TB400
2 No in use 2 No in use provides RJ45 BRI
3 TE Tx + 3 NT Rx + interface, supports
4 TE Rx + 4 NT Tx + for both TE mode
5 TE Rx - 5 NT Tx - and NT mode
6 TE Tx - 6 NT Rx -
7 No in use 7 No in use
8 No in use 8 No in use
PRI 1 Rx - MyPBX E1 and
2 Rx + MyPBX Enterprise
3 No in use M1 provide RJ45
4 Tx - PRI interface
5 Tx +
6 No in use
7 No in use
8 No in use

3.5 PRI debug

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.

pri set debug 2 span 2


Turn on PRI debug for span 2
pri set debug off span 2
Turn off PRI debug for span 2

4. SIP

4.1 Brief introduction of SIP protocol

Table 12 OSI and TCP/IP layers


OSI 7 layers TCP/IP Corresponding
Protocol

Application Application TFTP FTP


SNMP SMTP
Presentation
DNS Telnet SIP
Session
Transport Transport TCP UDP
Network Internet IP ICMP ARP
Data Link Network HDLC PPP SLIP
Physical
1. SIP ( Session Initiation Protocol) is the application layer control protocol for
multimedia communications on IP networks, it is used to create, modify, and
terminate a session process which has one or more participants.
2. SIP protocol can be used to initiate a session, also used to invite members to join the

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

4.2 SIP message

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.

Figure 4-1 Dialog and Transaction

4.2.1 SIP request

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.

Request-Line = Method SP Request-URI SP SIP-Version CRLF

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

Initiate a session request, invite users to join a session; the session


description is contained in the message body. For two-party call, the caller
indicated the acceptable media type and parameters in the session
description. The callee must show the media type which it wants to accept
INVITE in the message body of the successful response and also instruct the media
which will be sending. If you receive an invitation to attend the meeting,
the callee can determine the user has joined the conference according to
the Call-ID or the identity of the session description, and return the success
response message.
Confirmed receive the final response for INVITE request. The message only
ACK
can be used with INVITE message.

BYE End the session.

Cancel the uncompleted request, the completed request (ie receive a final
CANCEL
response for the request) is not affected

REGISTER Register

OPTIONS Query the server ability


Request message format
Note that the red part is a must in every SIP request message.
Table 14 Request message format
Command name Request URI Protocol
version
Call-id: value
Via: value
From: value
To: value
Contact: value
Cseq: value
Content-Length: value
Max-Forward: value
Content-Type: value
CRLF
SDP

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

4.2.2 SIP response

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.

Status-Line = SIP-Version SP Status-Code SP Reason-Phrase CRLF

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

the request contains bad syntax or cannot be


4xx Client Error
fulfilled at this server

the server failed to fulfill an apparently valid


5xx Server Error
request
Global the request cannot be fulfilled at any
6xx
Failure server
Response message format
Table 16 Response message format
SIP/Protocol Status code Reason-Phrase
version
Call-id: value
Via: value
From: value
To: value
Contact: value
Cseq: value
Content-Length: value
Max-Forward: value
Content-Type: value
CRLF
SDP
Example Response message:
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 192.168.4.16:5029;branch=z9hG4bK273563898;received=192.168.4.16
From: "502" <sip:502@192.168.5.139>;tag=1411642056
To: "502" <sip:502@192.168.5.139>;tag=as76ac4fea
Call-ID: 143870753@192.168.4.16
CSeq: 2301 REGISTER
Server: Asterisk PBX SVN--r1972M
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 29
Yeastar Technology Co., Ltd.
WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="7ce05bb3"
Content-Length: 0

4.3 Headers of SIP messages

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.

4.4 SIP Example session

4.4.1 Register Flow

Figure 4-2 Register flow

4.4.2 INVITE Flow

Figure 4-3 INVITE flow

4.4.3 Other SIP session

1. Options: query the server capabilities


2. Subscribe:subscribe UA status
3. Notify:notify UA status
Please look at the example package

Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 31
Yeastar Technology Co., Ltd.

4.5 SIP Debug

4.5.1 Asterisk CLI

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

Figure 4-4 Asteirsk SIP debug

Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 32
Yeastar Technology Co., Ltd.

Figure 4-5 Asterisk SIP debug for specific host

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.

Figure 4-6 Setup which interface to monitor

Figure 4-7 Start capture

Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 33
Yeastar Technology Co., Ltd.

Figure 4-8 Filters with SIP

Figure 4-9 Check VoIP calls

Figure 4-10 Check call follows

Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 34
Yeastar Technology Co., Ltd.

Figure 4-11 Check Call flow details

5. Other debug methods

5.1 SMTP debug

Step 1: Login MyPBX cli via ssh


Step 2: Prepare a test email
cd /etc/ssmtp/
vi test.eml

From: Jason <mypbx@sina.com>


To: Test <jason@yeastar.cn>
Subject: Test mail for Jason
MIME-Version: 1.0

Step 3: execute below commands


cp ssmtp.conf ssmtp_test.conf

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

Figure 5-1 SSMTP debug logs

5.2 Email SMS debug

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.

Figure 5-2 Login via ssh


Step 3 Enable debug
vi /etc/smscore/debug.conf
change the default settings to below:
pop3=yes
email=yes
sms=yes
core=yes
Step 4 Restart smscore
1 killall smscore
2 smscore
Step 5 Copy the logs printed and send it to yeastar for further analyzation

6. How to recover system through program cable

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 Connect the program cable

6.1.1 Connection
Before connecting RS232 to MyPBX device, please make sure that the power is turned
off.
1)MyPBX-Standard

PC

Figure 6-1 Connect RS232 interface for MyPBX Standard


2)MyPBX-SOHO & BizFAX E100/E200
MyPBX-SOHO has two kinds of serial port, one is 3pin and another is 10pin. They
have different connect ways, please check the following pictures:

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

Figure 6-4 Connect RS232 interface 3 pin mode for MyPBX E1

Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 39
Yeastar Technology Co., Ltd.

PC

Figure 6-5 Connect RS232 interface 10 pin mode for MyPBX E1

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

6.1.3 Using RS232 to update firmware

Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 40
Yeastar Technology Co., Ltd.

6.2 Recover system for MyPBX SOHO using a program cable

For this procedure you will need the following:


1) A modem cable (direct RS232).
2) A serial port on your PC.
3) A serial console client (e.g. putty for windows or minicom for Linux).
4) A TFTP Server (e.g. Tftpd32 for Windows).

Step1. Connect the network cable to MyPBX-SOHO.


Step2. Remove the top cover from MyPBX-SOHO and connect the RS232 cable between
MyPBX main board and your PC.
Step3. Power on MyPBX-SOHO.
Step4. Download the firmware and place it in your TFTIP Server’s repository.
Step5. Use putty.exe to connect via Serial Connector.
Download the putty.exe from http://www.yeastar.com/download/tools/putty.exe
Select Serial after you execute putty.exe, change the Speed to 57600

Figure 6-7 Connect with COM1


Click Open, you should see the picture below

Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 41
Yeastar Technology Co., Ltd.

Figure 6-8 Enter uboot


Step 7. Get ready of TFTP server and homepbx.ext2 (the file we send to you may in this
format with version number: 7.12.0.52.ext2, please replace homepbx.ext2 to
7.12.0.52.ext2).

Figure 6-9 TFTP server and image get ready


Step 8. Change the default TFTP server (assume your TFTP server ip is 192.168.1.100)
and default ip address(get one available ip for uboot ,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: If you couldn’t enter anything, please press 1111111 quickly when MyPBX-SOHO

Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 42
Yeastar Technology Co., Ltd.
power on.

bfin> set serverip 192.168.1.100


bfin> set ipaddr 192.168.1.99
bfin> set gatewayip 192.168.1.1
bfin> save
bfin> printenv
bfin> nand erase

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)

Step 10. Write image to onboard flash from u-boot

yeastar> nand write.jffs2 0x1000000 0 $(filesize)

Step 11 Reboot and login with factory default IP address 192.168.5.150.

yeastar> re

Step 12 Finish

Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 43
Yeastar Technology Co., Ltd.

6.3 Recover system for MyPBX Standard using program cable

For this procedure you will need the following:


1) A modem cable (direct RS232).
2) A serial port on your PC.
3) A serial console client (e.g. putty for windows or minicom for Linux).
4) A TFTP Server (e.g. Tftpd32 for Windows).

Step1. Connect the network cable to MyPBX-Standard.


Step2. Remove the top cover from MyPBX-Standard and connect the RS232 cable
between MyPBX main board and your PC.
Step3. Power on MyPBX-Standard.
Step4. Download the firmware and place it in your TFTIP Server’s repository.
Step5. Use putty.exe to connect via Serial Connector.
Download the putty.exe from http://www.yeastar.com/download/tools/putty.exe
Select Serial after you execute putty.exe, change the Speed to 57600

Figure 6-10 Connect with COM1


Click Open, you should see the picture below

Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 44
Yeastar Technology Co., Ltd.

Figure 6-11 Enter uboot


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: 2.14.0.14.ext2, please replace uImage.ext2 to
2.14.0.14.ext2).

Figure 6-12 TFTP server and image get ready


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 uboot, 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.

Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 45
Yeastar Technology Co., Ltd.

bfin> nand erase


bfin> set serverip 192.168.1.10
bfin> set ipaddr 192.168.1.99
bfin> set gatewayip 192.168.1.1
bfin> save
bfin> printenv

Note: Please execute nand erase to erase all incorrect configurations before write the
image to onboard flash.
Step 9. Upload image from network

yeastar> tftp 0x1000000 uImage.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.10; our IP address is 192.168.1.99
Filename 'uImage.ext2'.
Load address: 0x1000000
Loading:
#####################################################
############

#####################################################
############
done
Bytes transferred = 9051452 (8a1d3c hex)

Step 10. Write image to onboard flash from u-boot

yeastar> nand write.jffs2 0x1000000 0 $(filesize)

Step 11 Reboot and login with factory default IP address 192.168.5.150.

yeastar> re

Step 12 Finish

6.4 Recover system for MyPBX Enterprise using a program cable

For this procedure you will need the following:


1) A console cable (RJ45 to RS232).
Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 46
Yeastar Technology Co., Ltd.

Figure 6-13 RJ45-RS232 cable


2) A serial port on your PC.
3) A serial console client (e.g. putty for windows or minicom for Linux).
4) A TFTP Server (e.g. Tftpd32 for Windows).

Step1. Connect the network cable to MyPBX-Enterprise.


Step2. Connect the console cable RJ45 side to MyPBX Enterprise Console port, connect
the console cable RS232 side to your PC.
Step3. Power on MyPBX-Enterprise.
Step4. Download the firmware and place it in your TFTIP Server’s repository.
Step5. Use putty.exe to connect via Serial Connector.
Download the putty.exe from http://www.yeastar.com/download/tools/putty.exe
Note: Please check the Communications port detail under Device Manager Window:

Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 47
Yeastar Technology Co., Ltd.

Figure 6-14 COM1


Select Serial after you execute putty.exe, change the Speed to 57600

Figure 6-15 Connect with COM1

Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 48
Yeastar Technology Co., Ltd.
Click Open, you should see the picture below

Figure 6-16 Enter uboot

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).

Figure 6-17 TFTP server and image get ready

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.

pbx300> nand erase 0 0x4000000


pbx300> set serverip 192.168.1.10
pbx300> set ipaddr 192.168.1.99
pbx300> set gatewayip 192.168.1.1
pbx300> save
pbx300> printenv

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

pbx300>tftp 0x82000000 10.13.0.115.ext2


Using DaVinci EMAC device
TFTP from server 192.168.1.99; our IP address is 192.168.1.10
Filename '10.13.0.115.ext2'.
Load address: 0x82000000
Loading: #################################################################

#################################################################
done
Bytes transferred = 19878938 (12f541a hex)

Step 10. Write image to onboard flash from u-boot

pbx300>nand write 0x82000000 0 ${filesize}

NAND write: device 0 offset 0x0, size 0x12f541a


Skip bad block 0x004e0000
19878938 bytes written: OK
Step 11 Reboot and login with factory default IP address 192.168.5.150.

Pbx300> re

Step 12 Finish

Room 202, No. 23 Wanghai Road, 2nd Software Park, Xiamen, China 50

S-ar putea să vă placă și