[go: up one dir, main page]

CN101321227B - IP fax and its work method - Google Patents

IP fax and its work method Download PDF

Info

Publication number
CN101321227B
CN101321227B CN2008100224191A CN200810022419A CN101321227B CN 101321227 B CN101321227 B CN 101321227B CN 2008100224191 A CN2008100224191 A CN 2008100224191A CN 200810022419 A CN200810022419 A CN 200810022419A CN 101321227 B CN101321227 B CN 101321227B
Authority
CN
China
Prior art keywords
fax
module
message
call
control module
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN2008100224191A
Other languages
Chinese (zh)
Other versions
CN101321227A (en
Inventor
裴文江
刘庭芳
刘玉洁
陈泽含
刘晶
曹燕飞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
GUANGDONG JIAHE COMMUNICATION TECHNOLOGY Co Ltd
Original Assignee
Southeast University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Southeast University filed Critical Southeast University
Priority to CN2008100224191A priority Critical patent/CN101321227B/en
Publication of CN101321227A publication Critical patent/CN101321227A/en
Application granted granted Critical
Publication of CN101321227B publication Critical patent/CN101321227B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Facsimiles In General (AREA)

Abstract

An IP fax and working method thereof, referring to the technical field of utilizing IP technique to fax. This invention includes a mail sending/receiving module, a session initialization protocol fax device, opposite user agents, further includes an IP fax server; a control order port of the mail sending/receiving module is connected with the IP fax server; after receiving by IP fax server, the IP fax server will send a feedback information to the mail sending/receiving module; the first input end of the IP fax server is connected with an input end of the session initialization protocol fax device so as to realize the inter-conversion flowing from T.38 to the fax file form; the second input end of the IP fax server is connected with an input end of the opposite user agents so as to realize the encapsulation to the session initialization protocol stack. The target of this invention is to provide a target of source file fax transmission which has distinct gradation, simple protocol, powerful function, supports multi-path fax session, fax file distributing mailbox and plural file forms.

Description

一种IP传真装置及其工作方法 An IP fax device and its working method

技术领域technical field

本发明涉及利用IP技术进行传真的技术领域。The invention relates to the technical field of facsimile by using IP technology.

背景技术Background technique

目前,PBX(专用交换机)在企业办公机构中得到广泛运用,对企业办事效率的提高起到了重要作用。但传统的PBX采用的是缺乏开放性和标准性的专用技术,不但价格昂贵,而且对新兴的CTI(计算机与电话集成)和VOIP技术支持不够。近年来,随着Internet的流行和IP技术的成功,基于IP协议的IP-PBX应运而生,有望解决传统PBX的不足。At present, PBX (Private Branch Exchange) is widely used in enterprise offices, and plays an important role in improving the efficiency of enterprises. However, the traditional PBX adopts a special technology lacking openness and standardization, which is not only expensive, but also does not support the emerging CTI (Computer and Telephone Integration) and VOIP technology. In recent years, with the popularity of the Internet and the success of IP technology, IP-PBX based on IP protocol has emerged, which is expected to solve the shortcomings of traditional PBX.

IP-PBX系统实现了计算机网与电话交换机的功能合一。IP-PBX网络系统内各电话终端采用IP方式进行数据通信,不仅能进行通话,还能实现文本、数据、图像的传输,将电话网和计算机网统一成一整体,实现局域网内的电子办公。特别是在远距离协作商务、电子办公中将会充分发挥其强大的资源优势,为商务合作、工作重组带来便捷。The IP-PBX system realizes the integration of the functions of the computer network and the telephone exchange. Each telephone terminal in the IP-PBX network system adopts IP mode for data communication, which can not only make calls, but also realize the transmission of text, data and images, unify the telephone network and computer network as a whole, and realize electronic office in the local area network. Especially in long-distance collaborative business and electronic office, it will give full play to its powerful resource advantages and bring convenience to business cooperation and work reorganization.

IP-PBX局域网内的控制中心可根据具体情况,对计算机网络、电话网络进行有效地管理,从而达到资源共享。不同地区的IP-PBX网间借助Internet网,可实现廉价的远距离通信、电子办公和电子商务。The control center in the IP-PBX LAN can effectively manage the computer network and telephone network according to the specific situation, so as to achieve resource sharing. The IP-PBX networks in different regions can realize cheap long-distance communication, electronic office and e-commerce with the help of the Internet.

IP-PBX系统的研究开发受到多方面的关注,但是目前业界只有基于H.323协议的成品开发完成。而笔者参与开发的基于SIP协议(会话初始协议)、支持多种增值业务的IP-PBX系统在信息领域尚属于新事物。后期开发还会将目前应用广泛的即时短信(Instant Message)、多媒体业务等功能添加到本系统中,最终的IP-PBX系统必将受到诸多企业用户的青睐,创造巨大的经济利益。The research and development of the IP-PBX system has received many attentions, but at present the industry has only completed the development of finished products based on the H.323 protocol. However, the IP-PBX system that the author participates in developing is based on the SIP protocol (Session Initiation Protocol) and supports a variety of value-added services, which is still a new thing in the information field. Later development will also add functions such as instant message (Instant Message) and multimedia services that are currently widely used to this system. The final IP-PBX system will definitely be favored by many enterprise users and create huge economic benefits.

目前业界IP-PBX系统多是基于H.323协议标准开发的。At present, most IP-PBX systems in the industry are developed based on the H.323 protocol standard.

由于H.323标准过于复杂,对于许多只需要基本的“快速但不完美”的网络闸道间呼叫控制的产品而言过于复杂或昂贵。而且H.323不能与SS7(Signaling System#7,七号信令)整合,或补充SS7必须提供的强大功能。Because the H.323 standard is too complex, it is too complicated or expensive for many products that only need basic "fast but not perfect" call control between network gateways. Moreover, H.323 cannot be integrated with SS7 (Signaling System #7, No. 7 signaling), or supplement the powerful functions that SS7 must provide.

发明内容Contents of the invention

本发明目的是提供一种层次分明、协议简单、功能强大、支持多路传真会话、支持传真文件转发邮箱、支持多种文件格式的源文件传真发送的IP传真及其工作方法。The object of the present invention is to provide an IP fax with clear layers, simple protocol, powerful function, support for multi-channel fax sessions, fax file forwarding mailbox, source file fax sending in multiple file formats and its working method.

本发明为实现上述目的,采用如下技术方案:In order to achieve the above object, the present invention adopts the following technical solutions:

本发明包括邮件发送/接收模块、会话初始协议传真设备、背对背的用户代理,还包括IP传真服务器,邮件发送/接收模块的控制命令端口与IP传真服务器连接,IP传真服务器接收后会发出反馈信息到邮件发送/接收模块;IP传真服务器的第一输出端与会话初始协议传真设备的输入端连接,实现了T.38流到传真文件格式的相互转换;IP传真服务器的第二输出端与背对背的用户代理的输入端连接,实现了对会话初始协议栈的封装;The invention includes a mail sending/receiving module, a session initiation protocol fax device, a back-to-back user agent, and an IP fax server. The control command port of the mail sending/receiving module is connected to the IP fax server, and the IP fax server will send feedback information after receiving to the mail sending/receiving module; the first output end of the IP fax server is connected to the input end of the session initiation protocol fax device, realizing the mutual conversion from the T.38 stream to the fax file format; the second output end of the IP fax server is connected to the back-to-back The input terminal connection of the user agent implements the encapsulation of the session initiation protocol stack;

所述IP传真服务器包括传真控制模块、媒体处理模块、呼叫控制模块;The IP fax server includes a fax control module, a media processing module, and a call control module;

传真控制模块包括传真管理模块与呼叫状态机模块,传真管理模块实现对传真作业的管理、处理邮件发送/接收模块的传真操作请求、通过接口控制传真呼叫过程的同时也获取传真状态通知消息、通过模块间通信与邮件发送/接收模块进行交互;而呼叫状态机模块负责维护传真呼叫过程状态机、通过进程间通信完成传真注册/注销、传真呼入呼出;The fax control module includes a fax management module and a call state machine module. The fax management module realizes the management of fax jobs, processes the fax operation requests of the mail sending/receiving module, controls the fax call process through the interface, and obtains fax status notification messages. Inter-module communication interacts with the mail sending/receiving module; the call state machine module is responsible for maintaining the fax call process state machine, completing fax registration/logout, and fax incoming and outgoing calls through inter-process communication;

媒体处理模块:实现T.38流到传真文件格式的相互转换;与呼叫状态机模块之间通过进程间通信,完成媒体处理过程的控制,和媒体会话信息的交互;RTP协议解构;RTP通道建立/撤除,RTP流收发;Media processing module: realize the mutual conversion between T.38 stream and fax file format; complete the control of media processing process and the interaction with media session information through inter-process communication with the call state machine module; RTP protocol deconstruction; RTP channel establishment /Remove, send and receive RTP stream;

呼叫控制模块:实现会话初始协议栈的封装,可完成会话初始协议的构造与解析,与通信的对端进行链路的建立于释放;与呼叫状态机模块之间使用进程间通信,完成呼叫控制过程。Call control module: realize the encapsulation of the session initiation protocol stack, complete the construction and analysis of the session initiation protocol, establish and release the link with the peer end of the communication; use inter-process communication with the call state machine module to complete the call control process.

本发明应用上述IP传真装置发送传真的方法:The present invention applies the above-mentioned IP facsimile device to send the method of facsimile:

第一步,邮件发送/接收模块向传真控制模块发送信息,传真控制模块接收到信息后发出一个确认信息给邮件发送/接收模块,同时要求邮件发送/接收模块将具体的数据存放位置以路径名的形式给出,传真控制模块就发送一个传真确认消息给邮件发送/接收模块表明开始处理和发送所需要发送的传真图像;In the first step, the mail sending/receiving module sends information to the fax control module, and the fax control module sends a confirmation message to the mail sending/receiving module after receiving the information, and at the same time requires the mail sending/receiving module to save the specific data storage location with the path name Given in the form, the fax control module sends a fax confirmation message to the mail sending/receiving module to indicate the fax image that needs to be sent to start processing and sending;

第二步,传真控制模块判断是否可以进行传真传输,如果判断为否,即呼叫状态机模块满负荷工作,则发送失败,传真控制模块将会通知邮件发送/接收模块,让邮件发送/接收模块做重发;如果判断为是,则其会调用呼叫状态机模块的接口函数来产生一路新的传真会话,并将对端的I地址与对端信息以及所需要传输的传真数据路径等都进行记录;In the second step, the fax control module judges whether the fax transmission can be carried out. If it is judged as no, that is, the call state machine module is working at full capacity, then the sending fails, and the fax control module will notify the mail sending/receiving module to let the mail sending/receiving module Do retransmission; if it is judged to be yes, it will call the interface function of the call state machine module to generate a new fax session, and record the I address of the opposite end, the information of the opposite end, and the fax data path to be transmitted. ;

第三步,呼叫控制模块发送会话初始协议消息给传真会话被叫方,双方进行链路连接,并完成T.38协议版本号、传输T.38数据时最大传输速率、过程C中是否移出或插入填充比特、在线性格式和MMR格式之间进行能力转换、在线性格式和JBIG格式之间进行格式转换、是否是本地产生训练信号等信息协商以及发送训练信号、身份标识等信息的交互。在收到被叫方发送来的接收确认之后,可以切换到传输媒体的过程上来;这时,传真控制模块就通过媒体处理模块发送通过T.38协议加工过的传真信令与传真图像,与传真会话被叫方进行通信,并在传输完毕后切断链路;在此过程中,如果发生错误,传真控制模块就会结束本次传输,并向邮件发送/接收模块报告错误的原因;如果没有发送错误,传真管理模块会向邮件发送/接收模块报告此次发送成功。In the third step, the call control module sends a session initiation protocol message to the called party of the fax session, and the two parties perform a link connection, and complete the T.38 protocol version number, the maximum transmission rate when transmitting T.38 data, and whether to remove or Insert stuffing bits, perform capability conversion between linear format and MMR format, perform format conversion between linear format and JBIG format, negotiate information such as whether to generate training signals locally, and exchange information such as sending training signals and identification marks. After receiving the receiving confirmation sent by the called party, it can switch to the process of transmitting the media; at this time, the fax control module sends the fax signaling and fax images processed by the T.38 protocol through the media processing module, and communicates with the The called party of the fax session communicates and cuts off the link after the transmission is completed; during this process, if an error occurs, the fax control module will end the transmission and report the cause of the error to the mail sending/receiving module; if there is no If there is a sending error, the fax management module will report to the mail sending/receiving module that the sending is successful.

比较好的是:本发明的传真管理模块的具体工作如下:Preferably: the specific work of the fax management module of the present invention is as follows:

第1步:传真管理模块阻塞在消息队列之上,Step 1: The fax management module is blocked on the message queue,

第2步:传真管理模块从消息队列中取消息,Step 2: the fax management module gets the message from the message queue,

第3步:传真管理模块判断消息是否有效,若判断为是,传真管理模块通过调用呼叫状态机模块给出的驱动状态机的函数将消息传递给呼叫状态机模块;若判断为否,则丢弃消息并回到第1步;Step 3: whether the fax management module judges whether the message is valid, if it is judged to be yes, the fax management module passes the message to the call state machine module by calling the function of the driving state machine provided by the call state machine module; if it is judged to be no, it discards message and return to step 1;

第4步:传真管理模块得到函数返回值,并根据函数返回值发送消息到相应模块,返回第1步。Step 4: The fax management module gets the return value of the function, and sends a message to the corresponding module according to the return value of the function, and returns to step 1.

比较好的是:本发明的媒体处理模块的具体工作方法如下:Preferably: the specific working method of the media processing module of the present invention is as follows:

第1)步:Select是一个函数,管理多路消息,即一个消息集合;Select调用阻塞,一旦检测到有消息,进程获得执行;Step 1): Select is a function that manages multiple messages, that is, a message collection; the Select call is blocked, and once a message is detected, the process is executed;

第2)步:媒体处理模块获得一条消息,并对消息的有效性进行判断,若判断为是,则根据消息发送目标ID找到相应的会话;若判断为否,则返回第1)步;同时判断所获得的消息是否为创建信息,判断为是创建或释放一个对话,判断为否则返回第1)步;Step 2): the media processing module obtains a message, and judges the validity of the message, if it is judged to be yes, then finds the corresponding session according to the message sending target ID; if it is judged to be no, it returns to step 1); at the same time Judging whether the obtained message is creation information, judging that it is creating or releasing a dialogue, otherwise returning to step 1);

第3)步:媒体处理模块判断消息在读状态下的有效性,判断为是,则调用相应模块的接口函数,若判断为否,则返回第1)步;3) step: the media processing module judges the validity of the message in the read state, if it is judged to be yes, then call the interface function of the corresponding module, if it is judged to be no, then return to step 1);

第4)步:媒体处理模块判断是否需要发送消息,若判断为是,则发送消息到传真控制模块(41),返回第1)步;若判断为否则直接返回第1)步。The 4th) step: the media processing module judges whether to send a message, if it is judged to be yes, then send a message to the fax control module (41), and return to the 1st) step; if it is judged to be otherwise, directly return to the 1st) step.

本发明采用上述技术方案,与现有技术相比具有如下优点:层次分明、协议简单、功能强大、支持多路传真会话、支持传真文件转发邮箱、支持多种文件格式的源文件传真发送等特点。The present invention adopts the above-mentioned technical scheme, and compared with the prior art, it has the following advantages: clear hierarchy, simple protocol, powerful function, support for multi-channel fax sessions, support for fax file forwarding mailboxes, support for source file fax transmission in multiple file formats, etc. .

1、本发明基于SIP协议,具有SIP协议的灵活性、可扩展性强等特点,且协议简单。1. The present invention is based on the SIP protocol, has the characteristics of the flexibility and scalability of the SIP protocol, and the protocol is simple.

2、本发明能够管理多路传真,支持将收到的传真文件(Tiff格式)转发到用户邮箱的功能,功能更强大。2. The present invention can manage multiple faxes, and supports the function of forwarding received fax files (Tiff format) to user mailboxes, with more powerful functions.

3、本发明在PC端带虚拟驱动,支持word、pdf、bmp格式文件转成Tiff格式后作为传真发送。3. The present invention has a virtual driver on the PC side, and supports word, pdf, and bmp format files to be converted into Tiff format and sent as a fax.

4、本发明能够支持多种文件格式的源文件传真发送。4. The present invention can support source file fax sending in various file formats.

附图说明Description of drawings

图1是本发明传真服务器模块的结构示意图。Fig. 1 is a schematic diagram of the structure of the fax server module of the present invention.

图2是本发明传真服务器模块发送传真的步骤一的示意图。FIG. 2 is a schematic diagram of Step 1 of sending a fax by the fax server module of the present invention.

图3是本发明传真服务器模块发送传真的步骤二的示意图。FIG. 3 is a schematic diagram of Step 2 of sending a fax by the fax server module of the present invention.

图4是本发明传真服务器模块发送传真的步骤三的示意图。FIG. 4 is a schematic diagram of Step 3 of sending a fax by the fax server module of the present invention.

图5是本发明的进程间通信的消息格式。Fig. 5 is the message format of the inter-process communication of the present invention.

图6是本发明的函数调用传递消息的格式。Fig. 6 is the format of the function call transmission message of the present invention.

图7是本发明传真服务器模块传真管理模块的流程示意图。Fig. 7 is a flow diagram of the fax management module of the fax server module of the present invention.

图8是本发明传真服务器模块媒体处理模块的流程示意图Fig. 8 is a schematic flow chart of the media processing module of the fax server module of the present invention

图9是本发明传真服务器模块的软件架构示意图。FIG. 9 is a schematic diagram of the software architecture of the fax server module of the present invention.

具体实施方式Detailed ways

下面结合附图对本发明的技术方案进行详细说明,如图1所示,本发明包括邮件发送/接收模块1、会话初始协议传真设备2、背对背的用户代理3,还包括IP传真服务器4,邮件发送/接收模块1的控制命令端口与IP传真服务器4连接,IP传真服务器4接收后会发出反馈信息到邮件发送/接收模块1;IP传真服务器4的第一输出端与会话初始协议传真设备2的输入端连接,实现了T.38流到传真文件格式的相互转换;IP传真服务器4的第二输出端与背对背的用户代理3的输入端连接,实现了对会话初始协议栈的封装;Below in conjunction with accompanying drawing technical scheme of the present invention is described in detail, as shown in Figure 1, the present invention comprises mail sending/receiving module 1, SIP facsimile equipment 2, back-to-back user agent 3, also comprises IP facsimile server 4, mail The control command port of the sending/receiving module 1 is connected to the IP fax server 4, and the IP fax server 4 will send feedback information to the mail sending/receiving module 1 after receiving it; the first output port of the IP fax server 4 is connected to the session initiation protocol fax device 2 The input terminal of the IP fax server 4 is connected to the input terminal of the back-to-back user agent 3 to realize the mutual conversion of the T.38 stream to the fax file format; the second output terminal of the IP fax server 4 is connected to the input terminal of the back-to-back user agent 3 to realize the encapsulation of the session initiation protocol stack;

所述IP传真服务器4包括传真控制模块41、媒体处理模块42、呼叫控制模块43;The IP fax server 4 includes a fax control module 41, a media processing module 42, and a call control module 43;

传真控制模块41包括传真管理模块411与呼叫状态机模块412,传真管理模块411实现对传真作业的管理、处理邮件发送/接收模块1的传真操作请求、通过接口控制传真呼叫过程的同时也获取传真状态通知消息、通过模块间通信与邮件发送/接收模块1进行交互;而呼叫状态机模块412负责维护传真呼叫过程状态机、通过进程间通信完成传真注册/注销、传真呼入呼出;The fax control module 41 includes a fax management module 411 and a call state machine module 412. The fax management module 411 realizes the management of the fax job, processes the fax operation request of the mail sending/receiving module 1, controls the fax call process through the interface, and also obtains the fax State notification messages, interact with the mail sending/receiving module 1 through inter-module communication; and the call state machine module 412 is responsible for maintaining the fax call process state machine, completing fax registration/logout, fax incoming and outgoing calls through inter-process communication;

媒体处理模块42:实现T.38流到传真文件格式的相互转换;与呼叫状态机模块412之间通过进程间通信,完成媒体处理过程的控制,和媒体会话信息的交互;RTP协议解构;RTP通道建立/撤除,RTP流收发;Media processing module 42: realize the mutual conversion of T.38 stream to fax file format; communicate with the call state machine module 412 through inter-process communication, complete the control of the media processing process, and interact with the media session information; RTP protocol deconstruction; RTP Channel establishment/removal, RTP stream sending and receiving;

呼叫控制模块43:实现会话初始协议栈的封装,可完成会话初始协议的构造与解析,与通信的对端进行链路的建立于释放;与呼叫状态机模块412之间使用进程间通信,完成呼叫控制过程。Call control module 43: realize the encapsulation of the session initiation protocol stack, can complete the construction and analysis of the session initiation protocol, and establish and release the link with the opposite end of the communication; use inter-process communication with the call state machine module 412 to complete Call control process.

IP传真服务器4是整个IP传真实现的核心部分,传真控制模块41作为主控模块来管理整个模块的运行,并与IP-PBX系统中的其他模块进行交互。其次呼叫控制模块43用于管理发起呼叫和建立连接的过程,实现在IP环境下由SIP协议来控制的拨号,发起连接等过程,管理Fax Server模块中支持的一路对多路的点对点IP传真传输的各路状态。最后,T.30与T.38协议将实现在一起,组成一个媒体控制模块,来承载IP传真中所要发送的信令与图像数据。The IP fax server 4 is the core part of the entire IP fax implementation, and the fax control module 41 is used as the main control module to manage the operation of the entire module and interact with other modules in the IP-PBX system. Secondly, the call control module 43 is used for managing the process of initiating a call and setting up a connection, realizing the dialing controlled by the SIP protocol under the IP environment, initiating processes such as connection, and managing the point-to-point IP facsimile transmission of one-to-many channels supported in the Fax Server module status of each channel. Finally, the T.30 and T.38 protocols will be implemented together to form a media control module to carry the signaling and image data to be sent in IP fax.

邮件发送/接收模块作为传真服务器4对外的一个接口,可实现邮件收发和传真收发、管理的功能。主要功能为:对外部收发传真请求的处理、向传真服务器发送传真请求,以及根据传真服务器对传真请求的处理情况对外报告处理结果。并提供在传真接收后发送至用户邮箱的功能。The mail sending/receiving module serves as an external interface of the fax server 4, and can realize the functions of sending and receiving mails, sending and receiving faxes, and managing them. The main functions are: processing external fax requests, sending fax requests to the fax server, and reporting the processing results to the outside according to the processing of fax requests by the fax server. It also provides the function of sending the fax to the user's mailbox after receiving it.

以下是邮件发送/接收模块通过IP-PBX系统内部协议发送一个请求给传真服务器,从而实现发送传真的过程。The following is the process that the mail sending/receiving module sends a request to the fax server through the internal protocol of the IP-PBX system, so as to realize the process of sending a fax.

第一步,如图2所示,传真服务器模块4中的传真控制模块41负责处理邮件发送/接收模块1发送的消息。传真控制模块41首先会响应邮件发送/接收模块1的请求,并发回一个确认信息,并要求邮件发送/接收模块1将具体的数据存放位置以路径名的形式给出,此后,传真控制模块41就发送一个传真确认消息给邮件发送/接收模块1表明开始处理和发送所需要发送的传真图像。In the first step, as shown in FIG. 2 , the fax control module 41 in the fax server module 4 is responsible for processing the messages sent by the mail sending/receiving module 1 . Fax control module 41 first can respond to the request of mail sending/receiving module 1, and sends back a confirmation message, and requires mail sending/receiving module 1 to provide the specific data storage location with the form of path name, after this, fax control module 41 Just send a fax confirmation message to the mail sending/receiving module 1 to indicate to start processing and sending the fax image that needs to be sent.

第二步,如图3所示,传真控制模块41判断是否可以进行传真传输,如果其子模块呼叫状态机412已经满负荷工作,则发送失败,传真控制模块41将会通知邮件发送/接收模块1,让其做进一步处理。但绝大多数时候是成功的,则其会调用子模块呼叫状态机412的接口函数来产生一路新的状态,并将对端的IP地址与对端信息以及所需要传输的传真数据路径等都进行记录。Second step, as shown in Figure 3, the facsimile control module 41 judges whether can carry out facsimile transmission, if its submodule call state machine 412 works at full capacity, then send failure, the facsimile control module 41 will notify mail sending/receiving module 1, let it do further processing. But most of the time it is successful, then it will call the interface function of the submodule call state machine 412 to generate a new state, and carry out the IP address of the opposite end, the information of the opposite end, and the fax data path to be transmitted, etc. Record.

第三步,如图4所示,传真过程完全由传真控制模块41模块进行处理。首先,其通过呼叫控制模块43,发送SIP消息给对端,双方将进行链路的连接,并完成一些必要的参数的协商。在此之后,传真控制模块41认为链路已经建立,可以切换到传输媒体的过程上来。这时,传真控制模块41就通过媒体处理模块42,发送通过T.38协议加工过的传真信令与传真图像,与对端进行通信,并在传输完毕后切断链路。在此过程中,一旦发生错误(如对端无法连接等),则传真控制模块41就会结束本次传输,并向邮件发送/接收模块1报告错误的原因。如果一切顺利,传真管理模块411也会向邮件发送/接收模块1报告此次发送成功。In the third step, as shown in FIG. 4 , the facsimile process is completely handled by the facsimile control module 41 . First, it sends a SIP message to the opposite end through the call control module 43, and the two parties will connect the link and complete the negotiation of some necessary parameters. After that, the facsimile control module 41 considers that the link has been established, and can switch to the process of transmission media. At this time, the fax control module 41 sends the fax signal and fax image processed through the T.38 protocol through the media processing module 42, communicates with the opposite end, and cuts off the link after the transmission is completed. During this process, once an error occurs (such as the opposite end cannot be connected, etc.), the fax control module 41 will end this transmission and report the cause of the error to the mail sending/receiving module 1 . If everything goes well, the fax management module 411 will also report to the mail sending/receiving module 1 that the sending is successful.

在上述论述中,其传输过程是建立在模块间能够良好协作的基础上的。模块在实现中可能会被实现为分开的进程,也有可能会被实现为函数形式,故定义好模块间消息传递的格式非常重要。下面就对模块间的通信格式进行规范,对于进程间的通信,则定义如图5所示的消息格式。其中,发送模块编号与接受模块编号是事先规定好的各个模块的ID号,而消息ID号表明是何种消息,其具体内容在随后消息内容字段中给出。而对于函数类型的消息传递,则定义如图6所示的消息格式:在该格式中,状态编号对应与每一路的状态,消息ID规定了消息的种类,其内容出现在消息内容字段中。In the above discussion, the transmission process is based on the good cooperation between modules. Modules may be implemented as separate processes, or as functions, so it is very important to define the format of message passing between modules. In the following, the communication format between modules is regulated, and for the communication between processes, the message format shown in Figure 5 is defined. Wherein, the number of the sending module and the number of the receiving module are the ID numbers of each module specified in advance, and the ID number of the message indicates what kind of message it is, and its specific content is given in the subsequent message content field. For the message delivery of the function type, the message format as shown in Figure 6 is defined: in this format, the state number corresponds to the state of each channel, the message ID specifies the type of message, and its content appears in the message content field.

这样就将传真服务器4按照功能划分成了比较清晰与功能相对独立的几个子模块,各个模块的实现可以相对独立,并在后期调试工作中可以逐个调试,可以提高整个开发过程的效率。In this way, the fax server 4 is divided into several sub-modules that are relatively clear and relatively independent in function according to the functions. The realization of each module can be relatively independent, and can be debugged one by one in the later stage debugging work, which can improve the efficiency of the entire development process.

传真管理模块411是整个传真服务器4的控制中心,对其他子模块的协同工作有着重要的作用,主要负责消息的接受与发送。图7所示其主要工作流程如下:The fax management module 411 is the control center of the entire fax server 4, plays an important role in the cooperation of other sub-modules, and is mainly responsible for receiving and sending messages. The main workflow shown in Figure 7 is as follows:

第1步:传真管理模块阻塞在消息队列之上,Step 1: The fax management module is blocked on the message queue,

第2步:传真管理模块从消息队列中取消息,Step 2: the fax management module gets the message from the message queue,

第3步:传真管理模块判断消息是否有效,若判断为是,传真管理模块通过调用呼叫状态机模块给出的驱动状态机的函数将消息传递给呼叫状态机模块;若判断为否,则丢弃消息并回到第1步;Step 3: whether the fax management module judges whether the message is valid, if it is judged to be yes, the fax management module passes the message to the call state machine module by calling the function of the driving state machine provided by the call state machine module; if it is judged to be no, it discards message and return to step 1;

第4步:传真管理模块得到函数返回值,并根据函数返回值发送消息到相应模块,返回第1步。Step 4: The fax management module gets the return value of the function, and sends a message to the corresponding module according to the return value of the function, and returns to step 1.

媒体处理模块42本身被实现为一个单独的进程。该进程是通过Linux操作系统标准的select系统调用阻塞在一组进程间通信连接之上,一旦有一个信息到来,该进程就会恢复执行,由于媒体处理模块42的主控模块是媒体状态控制模块,故其会率先得到执行。媒体状态控制模块运行后,其首先从接口中取得一条完整的消息,消息的格式同样是符合进程间通信的统一格式,然后根据消息内容中的目标会话ID找到相应会话的结构体,然后分析在该会话所处状态下,所接收的消息是否有效,因为一种状态下只能接受某几种消息,对其他消息是不响应的,如果有效则产生相应的状态迁徙,调用子模块提供的函数进行相应处理,最后通过与传真控制模块41的进程间通信连接将状态迁徙产生的消息再以进程间通信标准消息格式发送回去。其完整的处理流程如图8所示:The media processing module 42 itself is implemented as a separate process. This process is blocked on a group of inter-process communication connections by the select system call of the Linux operating system standard. Once a message arrives, the process will resume execution. Because the main control module of the media processing module 42 is a media state control module , so it will be executed first. After the media state control module runs, it first obtains a complete message from the interface. The format of the message is also consistent with the unified format of inter-process communication. Then, it finds the structure of the corresponding session according to the target session ID in the message content, and then analyzes the In the state of the session, whether the received message is valid, because only certain types of messages can be accepted in a state, and it does not respond to other messages. If it is valid, the corresponding state transition will be generated, and the function provided by the submodule will be called. Corresponding processing is performed, and finally the message generated by the state transition is sent back in an inter-process communication standard message format through the inter-process communication connection with the fax control module 41 . Its complete processing flow is shown in Figure 8:

第1)步:Select调用阻塞,有消息,进程获得执行;Select是一个函数,管理多路消息,即一个消息集合。平时若这个消息集合内的消息事件均未发生,则一直将调用Select函数的进程一直阻塞着;直到该消息集合内的某一个或几个消息事件发生,此时,Select将进程从阻塞状态唤醒,并告诉进程具体是哪些消息事件发生了,进程得以往下继续执行,并处理这些消息事件;Step 1): The Select call is blocked, there is a message, and the process is executed; Select is a function that manages multiple messages, that is, a message set. Usually, if none of the message events in this message set occurs, the process that calls the Select function will be blocked all the time; until one or several message events in the message set occur, at this time, Select will wake up the process from the blocked state , and tell the process which message events have occurred, and the process can continue to execute and process these message events;

第2)步:媒体处理模块获得一条消息,并对消息的有效性进行判断,若判断为是,则根据消息发送目标ID找到相应的会话;若判断为否,则返回第1)步;同时判断所获得的消息是否为创建信息,判断为是创建或释放一个对话,判断为否则返回第1)步;Step 2): the media processing module obtains a message, and judges the validity of the message, if it is judged to be yes, then finds the corresponding session according to the message sending target ID; if it is judged to be no, it returns to step 1); at the same time Judging whether the obtained message is creation information, judging that it is creating or releasing a dialogue, otherwise returning to step 1);

第3)步:媒体处理模块判断消息在读状态下的有效性,判断为是,则调用相应模块的接口函数,若判断为否,则返回第1)步;3) step: the media processing module judges the validity of the message in the read state, if it is judged to be yes, then call the interface function of the corresponding module, if it is judged to be no, then return to step 1);

第4)步:媒体处理模块判断是否需要发送消息,若判断为是,则发送消息到传真控制模块41,返回第1)步;若判断为否则直接返回第1)步。Step 4): The media processing module judges whether it is necessary to send a message, if it is judged to be yes, it sends a message to the fax control module 41, and returns to the 1st) step; otherwise it directly returns to the 1st) step.

综上所述,传真的阶段根据T.30协议的规定,主要分为呼叫建立、报文前过程、报文中过程、报文后过程以及呼叫释放五个阶段,分别命名为A、B、C、D、E五个阶段。其中呼叫建立阶段是传输的两端要由主叫方发起呼叫,而被叫方应该予以响应,这个过程与电话建立通话的过程相仿,其应该由呼叫控制模块43来完成,而报文前过程、报文中过程、报文后过程这三个阶段是传真特有的阶段,包括协商参数、训练信道以及传输传真数据等,T.38协议对些过程有详细的规定,所以,其应该属于媒体处理模块42来完成。最后一个阶段,呼叫释放阶段,是断开连接的过程,类似与普通电话的拆线阶段,因此应该属于呼叫控制模块43来完成。发送传真主要流程如下,假设次过程一切进行顺利,没有发生差错:To sum up, according to the provisions of the T.30 protocol, the fax stage is mainly divided into five stages: call establishment, pre-message process, message process, post-message process, and call release, which are named A, B, and C, D, E five stages. Wherein the call setup stage is that the two ends of the transmission will initiate a call by the calling party, and the called party should respond. This process is similar to the process of establishing a conversation with a telephone, and it should be completed by the call control module 43, while the process before the message The three stages of , the process in the message, and the process after the message are unique to fax, including negotiation parameters, training channels, and transmission of fax data. The T.38 protocol has detailed regulations on these processes, so it should belong to the media processing module 42 to complete. The last stage, the call release stage, is a disconnection process, similar to the disconnection stage of an ordinary telephone, so it should be completed by the call control module 43 . The main process of sending a fax is as follows, assuming that everything goes smoothly and no errors occur:

1)由传真控制模块41发送创建会话的消息给媒体处理模块42,通知其要创建一路新的会话状态。媒体处理模块42返回创建该会话成功的消息,同时媒体处理模块42中的状态会变迁到创建状态,而传真控制模块41中的状态将会又空闲状态变换为传真初时化状态。这个阶段属于初始化阶段,尚不属于传真五个阶段中的任何一个。1) The fax control module 41 sends a session creation message to the media processing module 42, informing it that a new session state is to be created. The media processing module 42 returns a message that the session is created successfully. Meanwhile, the state of the media processing module 42 will transition to the creation state, and the state of the fax control module 41 will change from the idle state to the fax initialization state. This stage belongs to the initialization stage and does not yet belong to any of the five stages of faxing.

2)由传真控制模块41发送呼出消息给呼叫控制模块43,并附带上所要呼叫的对端的信息,由呼叫控制模块43完成呼叫的整个过程,同时传真控制模块41中的状态变为正在呼叫状态。在此过程接受后,呼叫控制模块43将会向传真控制模块41报告呼叫成功,链路已经建立。此过程属于传真的A阶段。2) send outgoing messages to the call control module 43 by the fax control module 41, and attach the information of the opposite end to be called, the whole process of calling is completed by the call control module 43, and the state in the fax control module 41 becomes the calling state simultaneously . After the process is accepted, the call control module 43 will report to the fax control module 41 that the call is successful and the link has been established. This process belongs to the A stage of faxing.

3)由传真控制模块41发送消息给媒体处理模块42,通知其开始进行语音播放,并在同时把已经建立好的链路信息传递给媒体处理模块42,同时自己启动一个3秒的定时器,用来定时。媒体处理模块42将播放一段拨号音乐,来模拟传统传真从电话状态切换到传真状态所需要的传真切换音,此时,媒体处理模块42处于正在播放语音状态,而传真控制模块41仍然处于正在呼叫状态。该过程仍然属于A阶段。3) Send a message to the media processing module 42 by the fax control module 41, notify it to start voice playback, and at the same time pass the established link information to the media processing module 42, and simultaneously start a timer of 3 seconds, Used for timing. The media processing module 42 will play a section of dialing music to simulate the fax switching tone required for the traditional fax to switch from the telephone state to the fax state. At this time, the media processing module 42 is in the state of playing voice, and the fax control module 41 is still in the calling state. The process is still in Phase A.

4)在播放完拨号音后,对端会首先切换到传真模式,呼叫控制模块43会得到对端切换完毕的信息,并将此消息汇报给传真控制模块41。此时,传真控制模块41会发消息给媒体处理模块42,令其切换到传真状态,而媒体处理模块42会汇报状态切换成功的消息。媒体处理模块42这时处于得到ID信息状态,而传真控制模块41处于传真能力协商阶段。开始进入传真的B阶段。4) After the dial tone is played, the opposite end will first switch to the fax mode, and the call control module 43 will obtain the information that the opposite end has switched, and report this information to the fax control module 41 . At this time, the fax control module 41 will send a message to the media processing module 42 to make it switch to the fax state, and the media processing module 42 will report a message that the state switching is successful. At this time, the media processing module 42 is in the state of obtaining ID information, and the fax control module 41 is in the stage of fax capability negotiation. Get started on the B-stage of faxing.

5)由传真控制模块41与对端的通信,完成B、C、D三个阶段的任务,此过程全部由传真控制模块41负责,并在过程结束后,向传真控制模块41报告发送完毕的消息。在此过程中传真控制模块41一直处于传真传输状态,而媒体处理模块42将经历信息判决、等待对端发送、正在训练、正在传输页、数据传输结束以及会话结束等阶段。在此过程结束后,D阶段就此也就结束了。5) By the communication between the fax control module 41 and the opposite end, complete the tasks of three stages of B, C, and D. This process is all in charge of the fax control module 41, and after the process ends, report the sent message to the fax control module 41 . During this process, the fax control module 41 is always in the fax transmission state, and the media processing module 42 will go through stages such as information judgment, waiting for the peer to send, training, page transmission, data transmission end, and session end. When this process is over, Phase D is over.

6)传真控制模块41发送消息给呼叫控制模块43,让其释放链路,同时又发送消息给媒体处理模块42,让其释放刚才为了发送一路传真所申请的所有资源,此过程为阶段E。就此,一次完成的传真过程就结束了。6) The fax control module 41 sends a message to the call control module 43 to allow it to release the link, and at the same time sends a message to the media processing module 42 to allow it to release all the resources that have just been applied for in order to send a fax. This process is stage E. At this point, the facsimile process once completed is over.

接收传真主要流程如下(同样假设次过程一切进行顺利,没有发生差错):The main process of receiving faxes is as follows (also assume that the process goes smoothly and no errors occur):

1)呼叫控制模块43首先通过发送消息,通知传真控制模块41有一个对端的呼叫进入,传真控制模块41会认为呼叫链路开始建立,并切换其状态。从此过程开始,进入阶段A。1) The call control module 43 first notifies the fax control module 41 that there is an incoming call from the opposite end by sending a message, and the fax control module 41 will consider that the call link is established and switch its state. From this process, proceed to Phase A.

2)传真控制模块41发送消息给媒体处理模块42,通知其创建一路会话,如果该操作执行成功,则媒体处理模块42会返回确认消息,并使得传真控制模块41产生状态迁徙,并通知呼叫控制模块43发送确认信号,表明链路的建立。此时,处于A阶段。2) The fax control module 41 sends a message to the media processing module 42, informing it to create a session. If the operation is performed successfully, the media processing module 42 will return a confirmation message, and make the fax control module 41 generate a state transition, and notify the call control Module 43 sends an acknowledgment signal indicating the establishment of the link. At this point, it is in stage A.

3)由呼叫控制模块43发送消息给媒体处理模块42,通知其开始进行IP传真,并在同时把已经建立好的链路信息传递给媒体处理模块42,让其播放一段拨号音乐,来模拟传统传真从电话状态切换到传真状态所需要的传真切换音,此时,媒体处理模块42处于正在播放语音状态,此过程是定时的,所以不需要媒体处理模块42在完成后通知传真控制模块41。该过程仍然属于A阶段。3) Send a message to the media processing module 42 by the call control module 43, notify it to start IP fax, and at the same time pass the established link information to the media processing module 42, let it play a section of dialing music, to simulate the traditional The facsimile switching tone required by the facsimile switching from the phone state to the facsimile state. At this time, the media processing module 42 is in the state of playing the voice. This process is timed, so it is not necessary for the media processing module 42 to notify the fax control module 41 after completion. The process is still in Phase A.

4)传真控制模块41通知媒体处理模块42进行切换,此时,双方开始进行参数磋商和训练等,并由媒体处理模块42进行状态的实时报告。此阶段属于了传真的B阶段。4) The facsimile control module 41 notifies the media processing module 42 to switch. At this time, both parties start parameter negotiation and training, etc., and the media processing module 42 reports the status in real time. This stage belongs to the B stage of fax.

5)双方进行基于T.38协议的通信,并由媒体处理模块42报告传输进行的状态。此阶段主要属于B、C、D三个阶段。5) The two parties communicate based on the T.38 protocol, and the media processing module 42 reports the status of the transmission. This stage mainly belongs to three stages B, C, and D.

6)呼叫控制模块43向传真控制模块41报告对方挂断的消息,传真控制模块41则进行相应的状态切换,并释放链路,同时发送消息通知媒体处理模块42进行资源的释放。此过程属于传真的E阶段。6) The call control module 43 reports to the fax control module 41 that the other party hangs up, and the fax control module 41 performs a corresponding state switch, releases the link, and sends a message to notify the media processing module 42 to release resources. This process belongs to the E phase of faxing.

在上述的过程中,明显可以看到传真控制模块41是处于整个传真的过程控制的核心,其通过自身状态的维护与状态的迁徙,不断的发送各种消息给媒体处理模块42和呼叫控制模块43,使得这两个模块完成相应的功能,从而协调的完成传真的整个过程。In the above process, it can be clearly seen that the fax control module 41 is the core of the entire fax process control, and it continuously sends various messages to the media processing module 42 and the call control module through its own state maintenance and state migration 43, making the two modules complete the corresponding functions, so as to complete the whole process of faxing in a coordinated manner.

呼叫控制模块43的主要功能是为上层的SIP应用提供一个简单的、统一的编程界面。提供呼叫、保留、转移、发送/接收DTMF等功能,本模块对外提供一个统一的呼叫控制协议接口,该接口包括三类命令:用户命令、呼叫命令、控制命令。命令使用请求/应答模式。The main function of the call control module 43 is to provide a simple and unified programming interface for upper-layer SIP applications. Provide functions such as call, hold, transfer, send/receive DTMF, etc. This module provides a unified call control protocol interface, which includes three types of commands: user commands, call commands, and control commands. Commands use a request/reply pattern.

呼叫控制模块43集成了SIP协议栈与RTP协议栈,并通过状态机的控制来完成对两个协议栈的管理,保持一个会话所处的状态。SIP协议主要用于会话的发起,会话的确认,其可以模拟PSTN网络上拨号而发起连接的过程,RTP协议栈则主要语音的承载。因此,该模块按功能被划分为两个模块,一个通过SIP协议栈主要进行呼叫和协商等过程,另一个主要通过RTP库函数进行语音的承载。The call control module 43 integrates the SIP protocol stack and the RTP protocol stack, and completes the management of the two protocol stacks through the control of the state machine, and maintains the state of a session. The SIP protocol is mainly used for session initiation and session confirmation, which can simulate the process of dialing up and initiating a connection on the PSTN network, and the RTP protocol stack is mainly used for voice bearer. Therefore, this module is divided into two modules according to the function, one mainly carries out calling and negotiation processes through the SIP protocol stack, and the other mainly carries out voice bearer through the RTP library function.

呼叫控制模块与语音控制模块分别负责调用SIP协议栈与RTP协议栈的函数来进行通信。特别是呼叫控制模块,还需要维护会话呼叫状态并通过消息传输来与SIP应用程序进行通信。该通信的消息即要符合呼叫控制协议,协议包括三类命令:用户命令、呼叫命令、控制命令。具体主要描述如下:The call control module and the voice control module are responsible for calling the functions of the SIP protocol stack and the RTP protocol stack to communicate. In particular, the call control module also needs to maintain the session call state and communicate with the SIP application program through message transmission. The communication message must comply with the call control protocol, which includes three types of commands: user commands, call commands, and control commands. The specific main description is as follows:

用户命令:该组命令主要包括登陆和退出两条命令,对于使用呼叫控制模块43,其只能发送。在登陆成功之后、退出之前用户处于在线状态。只有处于在线状态,才能使用呼叫命令和控制命令。每一个连接在同一时间只能有一个用户在线。SIP应用可以与呼叫控制模块建立多个连接。登陆用于用户注册登陆,注册的同时向系统请求足够的资源,注册之后还要定时发送激活注册。退出用于用户退出,同时撤消其申请的资源。User commands: This group of commands mainly includes two commands, login and logout, which can only be sent when using the call control module 43 . After a successful login, the user is online before logging out. Call and control commands are available only when you are online. Each connection can only have one user online at a time. A SIP application can establish multiple connections with the call control module. Login is used for user registration and login. At the same time of registration, sufficient resources are requested from the system, and activation registration is sent regularly after registration. Exit is used to log out the user and revoke the resources they requested.

呼叫命令:该组命令主要用于发起呼叫,建立连接,挂断等操作,可以发送和接收。发起呼叫必须是呼叫的第一个命令,其需要指定全局唯一的call-id,用以标识这个呼叫。发起呼叫命令可以由SIP应用发起,此时SIP应用作为主叫方;或者由呼叫控制模块发起,此时SIP应用是被叫方。建立连接命令只能在呼叫建立或者震铃的状态下才能发起,应答之后呼叫处于连接状态。挂断命令可以在任意状态,除了空闲状态以外,下发起,终止一个呼叫。Call command: This group of commands is mainly used to initiate a call, establish a connection, hang up and other operations, and can be sent and received. Initiating a call must be the first command of the call, which needs to specify a globally unique call-id to identify the call. The command to initiate a call can be initiated by a SIP application, at this time, the SIP application is the calling party; or initiated by the call control module, at this time, the SIP application is the called party. The establish connection command can only be initiated when the call is established or ringing, and the call is in the connected state after answering. Hang up command can be initiated in any state, except idle state, to terminate a call.

控制命令:该组命令主要在会话中起到控制作用,控制命令包括HOLD、REFER、AUDIO、DTMF四个命令,对于使用CCM的模块,HOLD、AUDIO只能发送,REFER、DTMF可以发送和接收,注意,控制命令不改变呼叫状态。HOLD命令即保留/取回命令。如果指定了sid,就是只保留指定的sid,否则保留所有sid。REFER命令为呼叫转移命令。AUDIO命令与DTMF命令均为语音控制命令,会改变CCM模块的语音发送方式。Control commands: This group of commands mainly plays a role in controlling the conversation. The control commands include four commands: HOLD, REFER, AUDIO, and DTMF. For modules using CCM, HOLD and AUDIO can only be sent, while REFER and DTMF can be sent and received. Note that control commands do not change the call state. The HOLD command is the hold/retrieve command. If sid is specified, only the specified sid is reserved, otherwise all sids are reserved. The REFER command is a call transfer command. Both AUDIO commands and DTMF commands are voice control commands, which will change the voice transmission mode of the CCM module.

上述命令也即是SIP应用者可以发给呼叫控制模块的消息,该消息有固定的格式。The above command is also a message that the SIP user can send to the call control module, and the message has a fixed format.

呼叫控制模块43共有的9种状态,分别是空闲(IDLE)状态、正在发起呼叫(INVITING)状态、呼叫建立(INVITED)状态、接受(ACCEPTED)状态、震铃(RINGING)状态、呼叫转移(OFFERING)状态、连接(CONNECTED)状态、正在终止(TERMINATING)状态、已经终止(TERMINATED)状态。The call control module 43 has 9 kinds of states, which are idle (IDLE) state, initiating call (INVITING) state, call establishment (INVITED) state, acceptance (ACCEPTED) state, ringing (RINGING) state, call transfer (OFFERING) state, respectively. ) status, CONNECTED status, TERMINATING status, TERMINATED status.

语音服务模块的实现相对比较简单,其状态只有播放语音与与关闭语音两个状态,其状态是受呼叫控制模块的操控的。在链路建立后,呼叫控制模块将会发送消息(其格式与前面所述的命令格式相同)给语音服务模块,让其进行模式切换,进入播放语音状态,而在链路断开后,其也会通知语音服务模块将状态切换到关闭语音状态。The implementation of the voice service module is relatively simple, and its state only has two states of playing voice and closing voice, and its state is controlled by the call control module. After the link is set up, the call control module will send a message (its format is the same as the command format described above) to the voice service module to allow it to perform mode switching and enter the playing voice state. After the link is disconnected, its The voice service module will also be notified to switch the state to the voice off state.

如图9所示,本发明的各个进程与线程的具体作用如下:As shown in Figure 9, the specific effects of each process and thread of the present invention are as follows:

呼叫控制模块进程:主要负责与对端的链路建立等工作,其中实现了SIP协议的内容,是发起呼叫和接受呼入等功能的承载者。Call control module process: mainly responsible for the establishment of the link with the opposite end, etc., which implements the content of the SIP protocol, and is the bearer of functions such as initiating calls and accepting incoming calls.

媒体处理模块进程:该进程主要实现了T.30,T.4和T.38协议,在传真过程中负责实际信令与数据的传输,可以说是负责实际传输的核心。Media processing module process: This process mainly implements the T.30, T.4 and T.38 protocols, and is responsible for the actual signaling and data transmission during the facsimile process, which can be said to be the core responsible for the actual transmission.

TCP server线程:负责与邮件发送/接收模块的通信,监控与邮件发送/接收模块的消息收发,把格式化消息发送到消息队列中。TCP server thread: Responsible for communicating with the mail sending/receiving module, monitoring the message sending and receiving with the mail sending/receiving module, and sending formatted messages to the message queue.

呼叫处理模块TCP client线程:负责与呼叫处理模块的通信,监控与呼叫处理模块的消息收发,把格式消息发送到消息队列中。Call processing module TCP client thread: responsible for communicating with the call processing module, monitoring the message sending and receiving with the call processing module, and sending formatted messages to the message queue.

Media TCP client线程:负责与媒体处理模块通信,监控与媒体处理模块的消息收发,把格式消息发送到消息队列中。Media TCP client thread: responsible for communicating with the media processing module, monitoring the sending and receiving of messages with the media processing module, and sending formatted messages to the message queue.

Fax Control主线程:负责处理消息队列中的消息,实现对传真管理模块和呼叫状态机定义的功能。Fax Control main thread: responsible for processing messages in the message queue, and realizing the functions defined for the fax management module and call state machine.

图9显示了一个完整的传真服务器模块的软件架构。该架构中将这个模块实现为3个独立的进程。Figure 9 shows the software architecture of a complete fax server module. The architecture implements this module as three separate processes.

首先,传真控制模块进程是这个模块的核心,其是由传真管理模块和呼叫状态机两个模块共同构成,掌管着整个传真的状态与信息。由于传真管理模块和呼叫状态机两个模块互相间的关系非常密切,而且通信的实时性要求非常的高,所以我们将其合成了一个进程来实现,这样做虽然在实现时部分破坏了模块的独立性和模块划分的简洁性,但是其可以获得巨大的性能提升,所以还是非常明智的。该进程有一个消息队列,用来收集其他进程所发送过来的消息,并进行分析,然后触发传真管理模块的处理与呼叫状态机中相应的状态改变,与此同时,通过与其他进程相连接进程间通信连接将其需要其他模块完成的工作以固定格式的消息形式发送出去。比如,现在消息队列中是由呼叫控制模块发送过来的连接建立完毕消息,则传真控制模块接受此消息,并产生相应的状态切换,最后通过与媒体处理模块建立的进程间通信连接发送消息,让媒体处理模块进行下一步工作。如果其他进程没有给传真管理模块发送消息,则其将会组塞在该消息队列上,直到有新的消息需要处理为止。传真控制模块进程还包括三个子线程,这三个子线程的任务很简单,其就是不断的监听与其他进程所建立的进程间通信连接上是否有符合规定格式的消息到来,如果有,则将其投递到消息队列,由传真管理模块的主线程进行处理。需要这三个线程的原因是其能够阻塞在每一个进程间通信连接上,在真正有消息的时候再进行消息向消息队列的投递,而不需要主线程一直处于阻塞状态,来不断的监控三个进程间通信连接,从而增加了效率。First of all, the fax control module process is the core of this module, which is composed of two modules, the fax management module and the call state machine, which are in charge of the status and information of the entire fax. Since the two modules of the fax management module and the call state machine are very closely related to each other, and the real-time requirements of the communication are very high, so we synthesized them into a process to realize, although this partly destroys the module's Independence and simplicity of module division, but it can get huge performance improvements, so it is still very sensible. This process has a message queue, which is used to collect messages sent by other processes, analyze them, and then trigger the processing of the fax management module and the corresponding state changes in the call state machine. At the same time, the processes connected with other processes The inter-communication connection sends out the work it needs to be done by other modules in the form of fixed-format messages. For example, now in the message queue is the connection establishment complete message sent by the call control module, the fax control module accepts this message, and generates a corresponding state switch, and finally sends a message through the inter-process communication connection established with the media processing module, so that The media processing module proceeds to the next step. If other processes do not send messages to the fax management module, they will be stuck in the message queue until there are new messages to be processed. The facsimile control module process also includes three sub-threads. The tasks of these three sub-threads are very simple. It is to constantly monitor whether there is a message that meets the specified format on the inter-process communication connection established with other processes. Posted to the message queue, processed by the main thread of the fax management module. The reason for needing these three threads is that they can be blocked on each inter-process communication connection, and then deliver the message to the message queue when there is a real message, without the need for the main thread to be in a blocked state all the time to continuously monitor the three threads. An inter-process communication connection, which increases efficiency.

其次,呼叫控制模块将实现为一个单独的进程,其主要负责同远端进行建立连接。其与其他进程的通信方式主要有2种,第一,如果其有消息要报告传真控制模块进程,则通过消息队列,将所要发送的消息发送给传真控制模块。传真控制模块得到消息后会做相应的处理。第二,呼叫控制模块模块可以通过与传真控制的进程间通信连接来获得传真控制模块所要求其完成的任务。Secondly, the call control module will be implemented as a separate process, which is mainly responsible for establishing a connection with the remote end. There are mainly two ways to communicate with other processes. First, if it has a message to report to the process of the fax control module, it sends the message to be sent to the fax control module through the message queue. After receiving the message, the fax control module will deal with it accordingly. Second, the call control module can obtain the tasks required by the fax control module through inter-process communication connection with the fax control.

最后,将媒体处理模块实现为独立的媒体处理模块进程。该进程中实现了T.30,T.38与T.4等协议,该进程也与上面的呼叫控制模块进程类似,一方面通过消息队列向传真控制模块进程发送消息,并不断监控与传真控制模块进程相连接的进程间通信连接,从而完成传真控制模块进程指派给其的工作。Finally, implement the media processing module as an independent media processing module process. Protocols such as T.30, T.38 and T.4 are implemented in this process. This process is also similar to the above call control module process. On the one hand, it sends messages to the fax control module process through the message queue, and continuously monitors and faxes the control module. The inter-process communication connection that the module processes are connected to complete the work assigned to it by the fax control module process.

Claims (4)

1.一种IP传真装置,包括邮件发送/接收模块(1)、会话初始协议传真设备(2)、背对背的用户代理(3),其特征在于:还包括IP传真服务器(4),邮件发送/接收模块(1)的控制命令端口与IP传真服务器(4)连接,IP传真服务器(4)接收后会发出反馈信息到邮件发送/接收模块(1);IP传真服务器(4)的第一输出端与会话初始协议传真设备(2)的输入端连接,实现了T.38流到传真文件格式的相互转换;IP传真服务器(4)的第二输出端与背对背的用户代理(3)的输入端连接,实现了对会话初始协议栈的封装;1. A kind of IP facsimile device, comprise mail sending/receiving module (1), SIP facsimile equipment (2), back-to-back user agent (3), it is characterized in that: also comprise IP fax server (4), mail sends The control command port of the/receiving module (1) is connected with the IP fax server (4), and the IP fax server (4) will send feedback information to the mail sending/receiving module (1) after receiving it; the first IP fax server (4) The output end is connected with the input end of the session initiation protocol fax device (2), and the mutual conversion from the T.38 stream to the fax file format is realized; the second output end of the IP fax server (4) is connected with the back-to-back user agent (3) The input terminal is connected to realize the encapsulation of the session initial protocol stack; 所述IP传真服务器(4)包括传真控制模块(41)、媒体处理模块(42)、呼叫控制模块(43);The IP fax server (4) includes a fax control module (41), a media processing module (42), and a call control module (43); 传真控制模块(41)包括传真管理模块(411)与呼叫状态机模块(412),传真管理模块(411)实现对传真作业的管理、处理邮件发送/接收模块(1)的传真操作请求、通过接口控制传真呼叫过程的同时也获取传真状态通知消息、通过模块间通信与邮件发送/接收模块(1)进行交互;而呼叫状态机模块(412)负责维护传真呼叫过程状态机、通过进程间通信完成传真注册/注销、传真呼入呼出;The fax control module (41) includes a fax management module (411) and a call state machine module (412). The fax management module (411) realizes the management of fax operations, processes the fax operation request of the mail sending/receiving module (1), and passes While the interface controls the fax call process, it also obtains fax status notification messages, and interacts with the mail sending/receiving module (1) through inter-module communication; and the call state machine module (412) is responsible for maintaining the fax call process state machine, and through inter-process communication Complete fax registration/deregistration, incoming and outgoing fax calls; 媒体处理模块(42):实现T.38流到传真文件格式的相互转换;与呼叫状态机模块(412)之间通过进程间通信,完成媒体处理过程的控制,和媒体会话信息的交互;RTP协议解构;RTP通道建立/撤除,RTP流收发;Media processing module (42): realize the mutual conversion of T.38 stream to fax file format; communicate with the call state machine module (412) through inter-process communication, complete the control of media processing process, and the interaction of media session information; RTP Protocol deconstruction; RTP channel establishment/removal, RTP stream sending and receiving; 呼叫控制模块(43):实现会话初始协议栈的封装,可完成会话初始协议的构造与解析,与通信的对端进行链路的建立于释放;与呼叫状态机模块(412)之间使用进程间通信,完成呼叫控制过程。Call control module (43): realize the encapsulation of the session initiation protocol stack, can complete the construction and analysis of the session initiation protocol, and establish and release the link with the opposite end of the communication; use the process with the call state machine module (412) Inter-communication to complete the call control process. 2.一种权利要求1所述的IP传真装置发送传真的方法,其特征在于:2. A method for sending a fax by an IP fax device according to claim 1, characterized in that: 第一步,邮件发送/接收模块(1)向传真控制模块(41)发送信息,传真控制模块(41)接收到信息后发出一个确认信息给邮件发送/接收模块(1),同时要求邮件发送/接收模块(1)将具体的数据存放位置以路径名的形式给出,传真控制模块(41)就发送一个传真确认消息给邮件发送/接收模块(1)表明开始处理和发送所需要发送的传真图像;The first step, the mail sending/receiving module (1) sends information to the fax control module (41), and the fax control module (41) sends a confirmation message to the mail sending/receiving module (1) after receiving the information, and requires the mail to send /receiving module (1) provides the specific data storage location with the form of path name, and the fax control module (41) just sends a fax confirmation message to the mail sending/receiving module (1) to indicate that it starts to process and send what needs to be sent Fax image; 第二步,传真控制模块(41)判断是否可以进行传真传输,如果判断为否,即呼叫状态机模块(412)满负荷工作,则发送失败,传真控制模块(41)将会通知邮件发送/接收模块(1),让邮件发送/接收模块(1)重发;如果判断为是,则其会调用呼叫状态机模块(412)的接口函数来产生一路新的传真会话,并将对端的IP地址与对端信息以及所需要传输的传真数据路径等都进行记录;In the second step, the fax control module (41) judges whether fax transmission can be carried out, if it is judged as no, that is, the call state machine module (412) is working at full capacity, and then fails to send, and the fax control module (41) will notify the mail to send/ The receiving module (1) allows the mail sending/receiving module (1) to resend; if it is judged to be yes, then it will call the interface function of the call state machine module (412) to generate a new fax session all the way, and the IP address of the opposite end The address and peer information, as well as the fax data path to be transmitted, etc. are all recorded; 第三步,呼叫控制模块(43)发送会话初始协议消息给传真会话被叫方,双方进行链路连接,并完成T.38协议版本号、传输T.38数据时最大传输速率、过程C中是否移出或插入填充比特、在线性格式和MMR格式之间进行能力转换、在线性格式和JBIG格式之间进行格式转换、是否是本地产生训练信号等信息协商以及发送训练信号、身份标识等信息的交互。在收到被叫方发送来的接收确认之后,传真控制模块(41)认为链路已经建立,可以切换到传输媒体的过程上来;这时,传真控制模块(41)就通过媒体处理模块(42)发送通过T.38协议加工过的传真信令与传真图像,与传真会话被叫方进行通信,并在传输完毕后切断链路;在此过程中,如果发生错误,传真控制模块(41)就会结束本次传输,并向邮件发送/接收模块(1)报告错误的原因;如果没有发送错误,传真管理模块(411)会向邮件发送/接收模块(1)报告此次发送成功。In the third step, the call control module (43) sends the session initiation protocol message to the called party of the facsimile session, and both parties carry out the link connection, and complete the T.38 protocol version number, the maximum transmission rate when transmitting the T.38 data, and the process C Whether to remove or insert padding bits, perform capability conversion between linear format and MMR format, perform format conversion between linear format and JBIG format, negotiate information such as whether to generate training signals locally, and send information such as training signals and identification marks interact. After receiving the receiving confirmation sent by the called party, the facsimile control module (41) thinks that the link has been established, and can switch to the process of transmitting the medium; ) send fax signaling and fax images processed by the T.38 protocol, communicate with the called party of the fax session, and cut off the link after the transmission is completed; during this process, if an error occurs, the fax control module (41) Will end this transmission, and report the reason of the error to the mail sending/receiving module (1); if there is no sending error, the fax management module (411) will report this sending success to the mail sending/receiving module (1). 3.根据权利要求2所述的IP传真装置发送传真的方法,其特征在于:传真管理模块(411)的具体工作如下:3. the method for IP fax device sending fax according to claim 2, is characterized in that: the specific work of fax management module (411) is as follows: 第1步:传真管理模块阻塞在消息队列之上,Step 1: The fax management module is blocked on the message queue, 第2步:传真管理模块从消息队列中取消息,Step 2: the fax management module gets the message from the message queue, 第3步:传真管理模块判断消息是否有效,若判断为是,传真管理模块通过调用呼叫状态机模块给出的驱动状态机的函数将消息传递给呼叫状态机模块(412);若判断为否,则丢弃消息并回到第1步;Step 3: whether the fax management module judges whether the message is valid, if judged as yes, the fax management module passes the message to the call state machine module (412) by calling the function of the drive state machine provided by the call state machine module; if judged as no , discard the message and return to step 1; 第4步:传真管理模块得到函数返回值,并根据函数返回值发送消息到相应模块,返回第1步。Step 4: The fax management module gets the return value of the function, and sends a message to the corresponding module according to the return value of the function, and returns to step 1. 4.根据权利要求2所述的IP传真装置发送传真的方法,其特征在于:4. The method for sending a fax by an IP fax device according to claim 2, characterized in that: 媒体处理模块(42)的具体工作方法如下:The concrete work method of media processing module (42) is as follows: 第1)步:Select是一个函数,管理多路消息,即一个消息集合;Select调用阻塞,一旦检测到有消息,进程获得执行;Step 1): Select is a function that manages multiple messages, that is, a message collection; the Select call is blocked, and once a message is detected, the process is executed; 第2)步:媒体处理模块(42)获得一条消息,并对消息的有效性进行判断,若判断为是,则根据消息发送目标ID找到相应的会话;若判断为否,则返回第1)步;同时判断所获得的消息是否为创建信息,判断为是创建或释放一个对话,判断为否则返回第1)步;2nd) step: the media processing module (42) obtains a message, and judges the validity of the message, if it is judged to be yes, then find the corresponding session according to the message sending target ID; if it is judged to be no, then return to the first) Step; Judging whether the obtained message is the creation information simultaneously, judging as creating or releasing a dialogue, judging otherwise returning to step 1); 第3)步:媒体处理模块判断消息在读状态下的有效性,判断为是,则调用相应模块的接口函数,若判断为否,则返回第1)步;3) step: the media processing module judges the validity of the message in the read state, if it is judged to be yes, then call the interface function of the corresponding module, if it is judged to be no, then return to step 1); 第4)步:媒体处理模块判断是否需要发送消息,若判断为是,则发送消息到传真控制模块(41),返回第1)步;若判断为否则直接返回第1)步。The 4th) step: the media processing module judges whether to send a message, if it is judged to be yes, then send a message to the fax control module (41), and return to the 1st) step; if it is judged to be otherwise, directly return to the 1st) step.
CN2008100224191A 2008-07-11 2008-07-11 IP fax and its work method Expired - Fee Related CN101321227B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2008100224191A CN101321227B (en) 2008-07-11 2008-07-11 IP fax and its work method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2008100224191A CN101321227B (en) 2008-07-11 2008-07-11 IP fax and its work method

Publications (2)

Publication Number Publication Date
CN101321227A CN101321227A (en) 2008-12-10
CN101321227B true CN101321227B (en) 2010-07-07

Family

ID=40181026

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2008100224191A Expired - Fee Related CN101321227B (en) 2008-07-11 2008-07-11 IP fax and its work method

Country Status (1)

Country Link
CN (1) CN101321227B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103312915B (en) * 2012-03-14 2018-03-09 中兴通讯股份有限公司 The repeating method and device of radio facsimile
EP2848033A1 (en) * 2012-05-08 2015-03-18 Telefonaktiebolaget L M Ericsson (Publ) Feedback-based profiling for transport networks
CN105338381A (en) * 2015-10-29 2016-02-17 无锡天脉聚源传媒科技有限公司 Instruction transmitting method and device
CN105577979A (en) * 2015-12-15 2016-05-11 天津光电通信技术有限公司 A fax image forwarding device
CN106301698A (en) * 2016-08-10 2017-01-04 东软集团股份有限公司 A kind of time-out retransmission control method and dispensing device, reception device
CN111010489B (en) * 2019-11-20 2021-11-05 深圳震有科技股份有限公司 Fax data processing method and device, computer equipment and medium

Also Published As

Publication number Publication date
CN101321227A (en) 2008-12-10

Similar Documents

Publication Publication Date Title
US7978686B2 (en) System and method for feature-based services control using SIP
EP1472859B1 (en) Fax transmission over the packet network
CN1918893B (en) Method and system for providing a call answering service between a source telephone and a target telephone
CN100589509C (en) Call transfer method and call transfer system based on SIP protocol
CN101321227B (en) IP fax and its work method
US20090097478A1 (en) Techniques to access messaging services for branch offices
CN101022483A (en) System device and method for realizing special calling class service
CN101106485A (en) A method and system for using SIP soft terminal to realize monitoring of call center system
CN1951098A (en) System and method for voice scheduling and multimedia alerting
CN101854703B (en) Method, server and system for acquiring status information
CN101902455B (en) Open multimedia conference service system and implementing method thereof
CN100403261C (en) Realization method of pure software interactive voice response/voice mail equipment
CN101257540B (en) A Voice Gateway Connecting IPv6 VoIP and PSTN
CN1838673A (en) Method for establishing a useful data connection between terminal devices
CN102111415A (en) Interactive network voice response system with embedded VoIP and implementation method thereof
EP1863256A1 (en) A media stream bridging device and a media service system
CN101753577B (en) VoIP communication system based on SIP protocol and communication method thereof
JP4142265B2 (en) Multimedia message transmission based on Internet protocol standards
US7688763B2 (en) Method for establishing a communication connection in a direct communication network
CN100401692C (en) Monitoring Method of Packet Voice Network
CN101325630A (en) Network telephone system and operation method thereof
CN1607800B (en) A method and network system for implementing enhanced call control
CN100525193C (en) Method for implementing conference telephone in next generation network
TW200849951A (en) IP phone switchboard
CN1190941C (en) Calling center blended with packet exchange mode and circuit exchange mode

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
ASS Succession or assignment of patent right

Owner name: GUANGDONG JIAHE COMMUNICATION TECHNOLOGY CO., LTD.

Free format text: FORMER OWNER: SOWTHEAST UNIV.

Effective date: 20120511

C41 Transfer of patent application or patent right or utility model
COR Change of bibliographic data

Free format text: CORRECT: ADDRESS; FROM: 210096 NANJING, JIANGSU PROVINCE TO: 519080 ZHUHAI, GUANGDONG PROVINCE

TR01 Transfer of patent right

Effective date of registration: 20120511

Address after: Four, No. 1-4, building 5, 1, software processing center, No. 519080 Software Garden Road, Guangdong, Zhuhai

Patentee after: Guangdong Jiahe Communication Technology Co., Ltd.

Address before: 210096 Jiangsu city Nanjing Province four pailou No. 2

Patentee before: Southeast University

CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20100707

Termination date: 20150711

EXPY Termination of patent right or utility model