How do u do a publish request with sip for j2me I haven't seen any examples but have tried after registering:




try {
// open listener in application specific port 5080
// scn = (SipConnectionNotifier) Connector.open("sip:5070");

// build the contact URI
contact =
new String("sip:albacel@***.***.**.**:5070" /* + scn.getLocalAddress()+":"+scn.getLocalPort()*/);

// open client connection to the SIP registrar in this case "host.com"
scc = (SipClientConnection) Connector.open("sip:albacel@***.***.**.**");
// initialize REGISTER with appropriate headers
scc.initRequest("PUBLISH", scn);
scc.setHeader("From", "sip:albacel@***.***.**.**");
scc.setHeader("To", "sip:albacel@***.***.**.**");
scc.setHeader("Content-Type", "application/pidf+xml");
scc.setHeader("Event", "presence");
scc.setHeader("Expires", "1000");
scc.setHeader("Contact", contact);

scc.setHeader("Content-Length", Integer.toString(message.length()));

System.out.println("SET PUBLISHING HEADER");
OutputStream os = scc.openContentOutputStream();
os.write(message.getBytes());

os.close();
System.out.println("HERE");
// scc.send();
System.out.println("PUBLISH REQUEST SENT");

boolean handled = false;
int scode = 0;

while(!handled) {
SipHeader sh;
// wait max 30 secs for response
scc.receive(30000);
System.out.println("PUBLISHING REPONSE RECIEVED");
scode = scc.getStatusCode();
scc.toString();
switch(scode)
{
case 423:
System.out.println("423 PUBLISHING ERROR - Interval too brief");
break;

case 412:

System.out.println("412 PUBLISHING ERROR - Interval too brief");
break;

case 200:
// handle OK response
System.out.println("200 PUBLISHING GOOD");
handled = true;
break;
default:
// handle other responses
System.out.println("CODE: " + scode + " " + scc.getReasonPhrase() );
handled = true;
}
}
scc.close();
} catch(Exception ex) {
// handle Exceptions
}



On the server I get:


06:47:40,781 INFO [SipResourceAdaptor] Received Request:
PUBLISH sip:albacel@***.***.**.**:5060 SIP/2.0
Call-ID: 72eb7303d8a67cb8a06fbb27630cee1d@146.231.88.38
CSeq: 1 PUBLISH
Via: SIP/2.0/UDP ***.***.**.**:5070;branch=z9hG4bK5439631f506bb74221afe26a306608
98
Max-Forwards: 70
From: <sip:albacel@***.***.**.**>;tag=1892409154
To: <sip:albacel@***.***.**.**>
Event: presence
Expires: 1000
Contact: <sip:albacel@***.***.**.**:5070>
Content-Type: application/pidf+xml
Content-Length: 668

<?xml version='1.0' encoding='UTF-8'?><presence xmlns='urn:ietfarams:xml:nsi
df' xmlns:dm='urn:ietfarams:xml:nsidf:data-model' xmlns:rpid='urn:ietfarams:xml:nsidf:rpid' xmlns:c='urn:ietfaram
s:xml:nsidf:cipid' entity='sip:albacel@***.***.**.**'><tuple id='t54bc0589'><s
tatus><basic>open</basic></status><note>'onlin
e'</note></tuple></presence>
06:47:40,796 INFO [PublicationControlSbb] publication for resource sip:albacel@
146.231.88.38:5060 on event package presence not authorized


so it's giving me a 403 forbidden response.. Please help