Asterisk - The Open Source Telephony Project GIT-master-7e7a603
Public Member Functions | Data Fields | Static Public Attributes
FaxPcap Class Reference
Inheritance diagram for FaxPcap:
Inheritance graph
[legend]
Collaboration diagram for FaxPcap:
Collaboration graph
[legend]

Public Member Functions

def __init__ (self, outfile)
 
def add (self, ifp)
 

Data Fields

 date
 
 outfile
 
 prev_data
 
 seqno
 
 udpseqno
 

Static Public Attributes

 PCAP_PREAMBLE
 

Detailed Description

Definition at line 56 of file spandspflow2pcap.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  outfile 
)

Definition at line 62 of file spandspflow2pcap.py.

62 def __init__(self, outfile):
63 self.outfile = outfile
64 self.date = None
65 self.seqno = None
66 self.udpseqno = 128
67 self.prev_data = None
68
69 # Only do this if at pos 0?
70

Member Function Documentation

◆ add()

def add (   self,
  ifp 
)
Add the IFP packet.

T.38 basic format of UDPTL payload section with redundancy:

UDPTL_SEQNO
- 2 sequence number (big endian)
UDPTL_PRIMARY_PAYLOAD (T30?)
- 1 subpacket length (excluding this byte)
- 1 type of message (e.g. 0xd0 for data(?))
- 1 items in data field (e.g. 0x01)
- 2 length of data (big endian)
- N data
RECOVERY (optional)
- 2 count of previous seqno packets (big endian)
- N UDPTL_PRIMARY_PAYLOAD of (seqno-1)
- N UDPTL_PRIMARY_PAYLOAD of (seqno-2)
- ...

Definition at line 71 of file spandspflow2pcap.py.

71 def add(self, ifp):
72 """
73 Add the IFP packet.
74
75 T.38 basic format of UDPTL payload section with redundancy:
76
77 UDPTL_SEQNO
78 - 2 sequence number (big endian)
79 UDPTL_PRIMARY_PAYLOAD (T30?)
80 - 1 subpacket length (excluding this byte)
81 - 1 type of message (e.g. 0xd0 for data(?))
82 - 1 items in data field (e.g. 0x01)
83 - 2 length of data (big endian)
84 - N data
85 RECOVERY (optional)
86 - 2 count of previous seqno packets (big endian)
87 - N UDPTL_PRIMARY_PAYLOAD of (seqno-1)
88 - N UDPTL_PRIMARY_PAYLOAD of (seqno-2)
89 - ...
90 """
91 # First packet?
92 if self.seqno is None:
93 # Add preamble.
94 self._add_preamble()
95 # Start a second late (optional).
96 self._add_garbage(ifp.date)
97
98 # Set sequence, and fill with missing leading zeroes.
99 self.seqno = 0
100 for i in range(ifp.seqno):
101 self.add(IFP(date=ifp.date, seqno=i, data=bytearray([0])))
102
103 # Auto-increasing dates
104 if self.date is None or ifp.date > self.date:
105 self.date = ifp.date
106 elif ifp.date < self.date.replace(microsecond=0):
107 assert False, 'More packets than expected in 1s? {!r}/{!r}'.format(
108 ifp.date, self.date)
109 else:
110 self.date += timedelta(microseconds=9000)
111
112 # Add packet.
113 self.seqno = ifp.seqno
114 try:
115 self.outfile.write(self._make_packet(ifp.data))
116 except SkipPacket:
117 pass
118
static int replace(struct ast_channel *chan, const char *cmd, char *data, struct ast_str **buf, ssize_t len)
Definition: func_strings.c:888

References FaxPcap._add_garbage(), FaxPcap._add_preamble(), FaxPcap._make_packet(), FaxPcap.add(), FaxPcap.date, logmsg.date, spandspflow2pcap.IFP, len(), FaxPcap.outfile, FaxPcap.PCAP_PREAMBLE, FaxPcap.prev_data, replace(), FaxPcap.seqno, ast_bridge_hook_timer_parms.seqno, ast_frame.seqno, rtp_transport_wide_cc_packet_statistics.seqno, ast_rtp.seqno, multicast_rtp.seqno, and FaxPcap.udpseqno.

Referenced by FaxPcap.add().

Field Documentation

◆ date

date

Definition at line 64 of file spandspflow2pcap.py.

Referenced by FaxPcap.add().

◆ outfile

outfile

Definition at line 63 of file spandspflow2pcap.py.

Referenced by FaxPcap.add().

◆ PCAP_PREAMBLE

PCAP_PREAMBLE
static
Initial value:
= n2b(
'd4 c3 b2 a1 02 00 04 00'
'00 00 00 00 00 00 00 00'
'ff ff 00 00 71 00 00 00')

Definition at line 57 of file spandspflow2pcap.py.

Referenced by FaxPcap.add().

◆ prev_data

prev_data

Definition at line 67 of file spandspflow2pcap.py.

Referenced by FaxPcap.add().

◆ seqno

seqno

Definition at line 65 of file spandspflow2pcap.py.

Referenced by FaxPcap.add().

◆ udpseqno

udpseqno

Definition at line 66 of file spandspflow2pcap.py.

Referenced by FaxPcap.add().


The documentation for this class was generated from the following file: