title: Asterisk modify headers
body: <p>I want to replace my SPA2102 for asterisk. How can I modify headers, like From, To and Contact?
  I need to replace headers, like </p>
  
  <pre><code>From: "asterisk" &lt;sip:XXXX174264@ip.ip.ip.6&gt;;tag=as1ea48bca
  </code></pre>
  
  <p>To headers, like SPA2102.</p>
  
  <p>My SPA2102 sends it like</p>
  
  <pre><code>"XXXX174264" &lt;sip:XXXX174264@ip.ip.ip.6&gt;
  </code></pre>
  
  <p>How </p>
  
  <pre><code>#  tcpdump -nAieth0 port 5060 and net ip.ip.ip.0/24
  
  10:47:55.801914 IP 10.37.93.21.5060 &gt; ip.ip.ip.6.5060: SIP, length: 906
  E....j..@...
  %].............INVITE sip:474264@ip.ip.ip.6 SIP/2.0
  Via: SIP/2.0/UDP 10.37.93.21:5060;branch=z9hG4bK20d7bc88
  Max-Forwards: 70
  From: "asterisk" &lt;sip:XXXX174264@ip.ip.ip.6&gt;;tag=as1ea48bca
  To: &lt;sip:474264@ip.ip.ip.6&gt;
  Contact: &lt;sip:XXXX174264@10.37.93.21:5060&gt;
  Call-ID: 6b4c893e70628a626286cd0a748f93de@ip.ip.ip.6
  CSeq: 102 INVITE
  User-Agent: Linksys/SPA2102-5.2.5
  Date: Wed, 16 Jan 2013 04:47:55 GMT
  Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
  Supported: replaces, timer
  Content-Type: application/sdp
  Content-Length: 333
  
  v=0
  o=- 233070007 233070007 IN IP4 10.37.93.21
  s=Asterisk PBX 11.2.0
  c=IN IP4 10.37.93.21
  t=0 0
  m=audio 10004 RTP/AVP 0 8 3 111 101
  a=rtpmap:0 PCMU/8000
  a=rtpmap:8 PCMA/8000
  a=rtpmap:3 GSM/8000
  a=rtpmap:111 G726-32/8000
  a=rtpmap:101 telephone-event/8000
  a=fmtp:101 0-16
  a=silenceSupp:off - - - -
  a=ptime:20
  a=sendrecv
  
  10:47:55.822359 IP ip.ip.ip.6.5060 &gt; 10.37.93.21.5060: SIP, length: 348
  E..x..@.&gt;.#.....
  %]......d.CSIP/2.0 100 Trying
  Via: SIP/2.0/UDP 10.37.93.21:5060;branch=z9hG4bK20d7bc88
  From: "asterisk" &lt;sip:XXXX174264@ip.ip.ip.6&gt;;tag=as1ea48bca
  To: &lt;sip:474264@ip.ip.ip.6&gt;
  Call-ID: 6b4c893e70628a626286cd0a748f93de@ip.ip.ip.6
  CSeq: 102 INVITE
  Contact: &lt;sip:474264@ip.ip.ip.6:5060&gt;
  Server: MERA MVTS3G v.4.3.0-38t
  Content-Length: 0
  </code></pre>
  
  <p>I try to make call using SPA and Asterisk. Both register succes. But Asterisk can't make call.
  Here is tcpdump from SPA:</p>
  
  <pre><code>00:58:00.778565 IP 10.37.93.23.5060 &gt; ip.ip.ip.6.5060: SIP, length: 892
  Eh..........
  %].............INVITE sip:474264@ip.ip.ip.6 SIP/2.0
  Via: SIP/2.0/UDP 10.37.93.23:5060;branch=z9hG4bK-9b906813
  From: XXXX174264 &lt;sip:XXXX174264@ip.ip.ip.6&gt;;tag=e9377d83dbc079fo0
  To: &lt;sip:474264@ip.ip.ip.6&gt;
  Remote-Party-ID: XXXX174264 &lt;sip:XXXX174264@ip.ip.ip.6&gt;;screen=yes;party=calling
  Call-ID: 27e34e53-cdeded0f@10.37.93.23
  CSeq: 101 INVITE
  Max-Forwards: 70
  Contact: XXXX174264 &lt;sip:XXXX174264@10.37.93.23:5060&gt;
  Expires: 240
  User-Agent: Linksys/SPA2102-5.2.5
  Content-Length: 268
  Allow: ACK, BYE, CANCEL, INFO, INVITE, NOTIFY, OPTIONS, REFER
  Supported: x-sipura, replaces
  Content-Type: application/sdp
  
  v=0
  o=- 93383 93383 IN IP4 10.37.93.23
  s=-
  c=IN IP4 10.37.93.23
  t=0 0
  m=audio 16186 RTP/AVP 8 0 18 4 100
  a=rtpmap:8 PCMA/8000
  a=rtpmap:0 PCMU/8000
  a=rtpmap:18 G729a/8000
  a=rtpmap:4 G723/8000
  a=rtpmap:100 NSE/8000
  a=fmtp:100 192-193
  a=ptime:20
  a=sendrecv
  
  00:58:00.782580 IP ip.ip.ip.6.5060 &gt; 10.37.93.23.5060: SIP, length: 342
  ....E..r..@.&gt;.#.....
  %]......^..SIP/2.0 100 Trying
  Via: SIP/2.0/UDP 10.37.93.23:5060;branch=z9hG4bK-9b906813
  From: "XXXX174264" &lt;sip:XXXX174264@ip.ip.ip.6&gt;;tag=e9377d83dbc079fo0
  To: &lt;sip:474264@ip.ip.ip.6&gt;
  Call-ID: 27e34e53-cdeded0f@10.37.93.23
  CSeq: 101 INVITE
  Contact: &lt;sip:474264@ip.ip.ip.6:5060&gt;
  Server: MERA MVTS3G v.4.3.0-38t
  Content-Length: 0
  
  
  00:58:02.479539 IP ip.ip.ip.6.5060 &gt; 10.37.93.23.5060: SIP, length: 683
  ....E.....@.&gt;."p....
  %].......&lt;.SIP/2.0 180 Ringing
  Via: SIP/2.0/UDP 10.37.93.23:5060;branch=z9hG4bK-9b906813
  From: "XXXX174264" &lt;sip:XXXX174264@ip.ip.ip.6&gt;;tag=e9377d83dbc079fo0
  To: &lt;sip:474264@ip.ip.ip.6&gt;;tag=109877804-3792792162-4082950052-3026001148
  Call-ID: 27e34e53-cdeded0f@10.37.93.23
  CSeq: 101 INVITE
  Contact: &lt;sip:474264@ip.ip.ip.6:5060&gt;
  Content-Type: application/sdp
  Server: MERA MVTS3G v.4.3.0-38t
  Content-Length:   258
  
  v=0
  o=- 1358621882 1358621882 IN IP4 ip.ip.ip.5
  s=-
  c=IN IP4 ip.ip.ip.5
  t=0 0
  m=audio 39878 RTP/AVP 8 0 18
  a=rtpmap:8 PCMA/8000
  a=rtpmap:0 PCMU/8000
  a=rtpmap:18 G729/8000
  a=fmtp:18 annexb=no
  a=ptime:20
  a=sendrecv
  a=silenceSupp:off - - - -
  
  00:58:30.832778 IP 10.37.93.23.5060 &gt; ip.ip.ip.6.5060: SIP, length: 339
  Eh.o........
  %]..........[O.CANCEL sip:474264@ip.ip.ip.6 SIP/2.0
  Via: SIP/2.0/UDP 10.37.93.23:5060;branch=z9hG4bK-9b906813
  From: XXXX174264 &lt;sip:XXXX174264@ip.ip.ip.6&gt;;tag=e9377d83dbc079fo0
  To: &lt;sip:474264@ip.ip.ip.6&gt;
  Call-ID: 27e34e53-cdeded0f@10.37.93.23
  CSeq: 101 CANCEL
  Max-Forwards: 70
  User-Agent: Linksys/SPA2102-5.2.5
  Content-Length: 0
  
  
  00:58:30.836782 IP ip.ip.ip.6.5060 &gt; 10.37.93.23.5060: SIP, length: 385
  ....E.....@.&gt;.#.....
  %].......7.SIP/2.0 200 OK
  Via: SIP/2.0/UDP 10.37.93.23:5060;branch=z9hG4bK-9b906813
  From: "XXXX174264" &lt;sip:XXXX174264@ip.ip.ip.6&gt;;tag=e9377d83dbc079fo0
  To: &lt;sip:474264@ip.ip.ip.6&gt;;tag=109877804-3792792162-4082950052-3026001148
  Call-ID: 27e34e53-cdeded0f@10.37.93.23
  CSeq: 101 CANCEL
  Contact: &lt;sip:474264@ip.ip.ip.6:5060&gt;
  Server: MERA MVTS3G v.4.3.0-38t
  Content-Length: 0
  
  
  00:58:30.838775 IP ip.ip.ip.6.5060 &gt; 10.37.93.23.5060: SIP, length: 450
  ....E.....@.&gt;.#Y....
  %].........SIP/2.0 487 Request Terminated
  Via: SIP/2.0/UDP 10.37.93.23:5060;branch=z9hG4bK-9b906813
  From: "XXXX174264" &lt;sip:XXXX174264@ip.ip.ip.6&gt;;tag=e9377d83dbc079fo0
  To: &lt;sip:474264@ip.ip.ip.6&gt;;tag=109877804-3792792162-4082950052-3026001148
  Call-ID: 27e34e53-cdeded0f@10.37.93.23
  CSeq: 101 INVITE
  Contact: &lt;sip:474264@ip.ip.ip.6:5060&gt;
  Server: MERA MVTS3G v.4.3.0-38t
  Reason: SIP;cause=487;text="Request Terminated"
  Content-Length: 0
  
  
  00:58:30.845777 IP 10.37.93.23.5060 &gt; ip.ip.ip.6.5060: SIP, length: 437
  Eh.........&amp;
  %].............ACK sip:474264@ip.ip.ip.6 SIP/2.0
  Via: SIP/2.0/UDP 10.37.93.23:5060;branch=z9hG4bK-9b906813
  From: XXXX174264 &lt;sip:XXXX174264@ip.ip.ip.6&gt;;tag=e9377d83dbc079fo0
  To: &lt;sip:474264@ip.ip.ip.6&gt;;tag=109877804-3792792162-4082950052-3026001148
  Call-ID: 27e34e53-cdeded0f@10.37.93.23
  CSeq: 101 ACK
  Max-Forwards: 70
  Contact: XXXX174264 &lt;sip:XXXX174264@10.37.93.23:5060&gt;
  User-Agent: Linksys/SPA2102-5.2.5
  Content-Length: 0
  </code></pre>
  
  <p>And tcpdump from Asterisk:</p>
  
  <pre><code>E...W,..@.      .
  %].............INVITE sip:474264@ip.ip.ip.6 SIP/2.0
  Via: SIP/2.0/UDP 10.37.93.21:5060;branch=z9hG4bK6422ee1e
  Max-Forwards: 70
  From: "asterisk" &lt;sip:XXXX174264@ip.ip.ip.6&gt;;tag=as43ada6c8
  To: &lt;sip:474264@ip.ip.ip.6&gt;
  Contact: &lt;sip:XXXX174264@10.37.93.21:5060&gt;
  Call-ID: 6e8b22967d9c55ea349abb636c0e5263@ip.ip.ip.6
  CSeq: 102 INVITE
  User-Agent: Linksys/SPA2102-5.2.5
  Date: Sat, 19 Jan 2013 18:49:27 GMT
  Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
  Supported: replaces, timer
  Content-Type: application/sdp
  Content-Length: 333
  
  v=0
  o=- 413424664 413424664 IN IP4 10.37.93.21
  s=Asterisk PBX 11.2.0
  c=IN IP4 10.37.93.21
  t=0 0
  m=audio 10008 RTP/AVP 0 8 3 111 101
  a=rtpmap:0 PCMU/8000
  a=rtpmap:8 PCMA/8000
  a=rtpmap:3 GSM/8000
  a=rtpmap:111 G726-32/8000
  a=rtpmap:101 telephone-event/8000
  a=fmtp:101 0-16
  a=silenceSupp:off - - - -
  a=ptime:20
  a=sendrecv
  
  00:49:27.073977 IP ip.ip.ip.6.5060 &gt; 10.37.93.21.5060: SIP, length: 348
  E..x..@.&gt;.#.....
  %]......d..SIP/2.0 100 Trying
  Via: SIP/2.0/UDP 10.37.93.21:5060;branch=z9hG4bK6422ee1e
  From: "asterisk" &lt;sip:XXXX174264@ip.ip.ip.6&gt;;tag=as43ada6c8
  To: &lt;sip:474264@ip.ip.ip.6&gt;
  Call-ID: 6e8b22967d9c55ea349abb636c0e5263@ip.ip.ip.6
  CSeq: 102 INVITE
  Contact: &lt;sip:474264@ip.ip.ip.6:5060&gt;
  Server: MERA MVTS3G v.4.3.0-38t
  Content-Length: 0
  
  
  00:49:27.100102 IP ip.ip.ip.6.5060 &gt; 10.37.93.21.5060: SIP, length: 478
  E.....@.&gt;.#?....
  %].........SIP/2.0 603 Subscriber account disabled
  Via: SIP/2.0/UDP 10.37.93.21:5060;branch=z9hG4bK6422ee1e
  From: "asterisk" &lt;sip:XXXX174264@ip.ip.ip.6&gt;;tag=as43ada6c8
  To: &lt;sip:474264@ip.ip.ip.6&gt;;tag=179071226-3792791650-4082950052-3026001148
  Call-ID: 6e8b22967d9c55ea349abb636c0e5263@ip.ip.ip.6
  CSeq: 102 INVITE
  Contact: &lt;sip:474264@ip.ip.ip.6:5060&gt;
  Server: MERA MVTS3G v.4.3.0-38t
  Reason: Centrex;cause=179;text="Subscriber account disabled"
  Content-Length: 0
  
  
  00:49:27.100295 IP 10.37.93.21.5060 &gt; ip.ip.ip.6.5060: SIP, length: 433
  E...W-..@.
  .
  %]...........#,ACK sip:474264@ip.ip.ip.6 SIP/2.0
  Via: SIP/2.0/UDP 10.37.93.21:5060;branch=z9hG4bK6422ee1e
  Max-Forwards: 70
  From: "asterisk" &lt;sip:XXXX174264@ip.ip.ip.6&gt;;tag=as43ada6c8
  To: &lt;sip:474264@ip.ip.ip.6&gt;;tag=179071226-3792791650-4082950052-3026001148
  Contact: &lt;sip:XXXX174264@10.37.93.21:5060&gt;
  Call-ID: 6e8b22967d9c55ea349abb636c0e5263@ip.ip.ip.6
  CSeq: 102 ACK
  User-Agent: Linksys/SPA2102-5.2.5
  Content-Length: 0
  </code></pre>