Adding a custom SIP header to outgoing fax calls

Hello,

I’m using the sendFax dialplan function to send faxes and I’m looking for a way to add a specific SIP header to those calls.
I tried the addHeader function but it seems to be only applicable to the calls initiated with the Dial function.
Is there a way to do so ?

Thanks

What are you trying to do? It may be possible to send fax messages via SIP, but there’s no guarantee that the other end will use SIP and will therefore be able to evaluate any custom header.

Thanks for your reply.

I’m using Asterisk for a mail2fax service over the PSTN network in SIP. This system has already been working well for many years with the sendFax function.
The telecom regulation authority of my country now requires that we send location information in each call (using the P-Access-Network-Info header).
Therefore I know that the other end can evaluate this header.

I was able to get the location data into the dialplan:

[mail2fax]
exten => _X.,1,NoOp(call Mail2fax)
same => n,ExecIf($["${location}" != “”]?SIPAddHeader(P-Access-Network-Info: GSTN;operator-specific-GI="${location}";network-provided))
same => n,SendFax(${faxfile},df)

I was hoping the SIPAddHeader function would help me as it does before any Dial function but the resulting SIP INVITE never contains the new header.

[Aug 27 18:02:17] DEBUG[28123][C-0000761a] pbx_variables.c: Result of ‘location’ is ‘123456700’
[Aug 27 18:02:17] DEBUG[28123][C-0000761a] pbx.c: Launching ‘ExecIf’
[Aug 27 18:02:17] DEBUG[28123][C-0000761a] chan_sip.c: SIP Header added “P-Access-Network-Info: GSTN;operator-specific-GI=“123456700”;network-provided” as __SIPADDHEADER01
[Aug 27 18:02:17] DEBUG[28123][C-0000761a] pbx_variables.c: Result of ‘faxfile’ is ‘/home/smartfax/outgoing_faxes/pending/612908420a13d.tiff’
[Aug 27 18:02:17] DEBUG[28123][C-0000761a] pbx.c: Launching ‘SendFAX’
[Aug 27 18:02:17] DEBUG[28123][C-0000761a] res_fax.c: Reserving a FAX session from ‘Spandsp FAX Driver’.
[Aug 27 18:02:17] DEBUG[28123][C-0000761a] res_fax.c: Selected FAX technology module (Spandsp FAX Driver) does not support reserving sessions.

How do you get to [mail2fax]? It could be that it is already to late to add headers. I’d try to use a pre-dial-handler with the initial Dial() command, provided that you call Dial with the G option.

Definitely too late. Headers must be set before the initial INVITE and SendFax has no provision to specify a destination, so the INVITE must already have been sent.

Ok, it was too late.

I’m using call files and just managed to fix my issue by including a Set: __SIPADDHEADER… parameter in my files.

Thanks a lot !

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.