Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content-Type check for incoming SIP MESSAGE #20

Closed
jmillan opened this issue Nov 16, 2012 · 8 comments
Closed

Content-Type check for incoming SIP MESSAGE #20

jmillan opened this issue Nov 16, 2012 · 8 comments
Assignees
Milestone

Comments

@jmillan
Copy link
Member

jmillan commented Nov 16, 2012

Enhance the content type check for incoming SIP MESSAGES. Nowadays only an exact "text/plain" value is allowed, but not media type parameters.

Also, respond a (415 Unsupported Media Type) if received content is not "text/plain"

@ghost ghost assigned jmillan Nov 16, 2012
@saghul
Copy link
Contributor

saghul commented Nov 16, 2012

We should deliver all messages to the app. Then the user decides. Now, as for replying 415, we have 2 choices (from the top of my head):

  • Don't reply in the library, let the user to it (accept() and reject(code) methods)
  • Have a way to configure which are the acceptable types in the UA

I like the first approach because it's more flexible and allows for extra checks like the wrapped content type in case CPIM is used.

@ibc
Copy link
Member

ibc commented Nov 16, 2012

It's like we receive an INVITE and "deliver it to the application on top of OverSIP", leaving the user to deal with WebRTC stuff, IMHO it makes no sense.

JsSIP is a SIP stack and thus must provide a usable API for common tasks as receiving a text message, without forcing the end user (web developer) to deal with Content-Type value.

BTW:

  • If the user defines a function (or functions) for event newMessage (in UA) then execute it and don't reply automatically 200.
  • If not, the JsSIP must reply "something" (maybe 404 since the user does not want to receive MESSAGE requests).

@ibc
Copy link
Member

ibc commented Nov 16, 2012

BTW this requires a new API for incomming MESSAGES. But a easy API which means don't pass (always) the full body to the high user (imagine passing the "iscomposing" XML body... no please). Anyhow let's discuss such a new API in a new issue (not for 0.2 branch).

@saghul
Copy link
Contributor

saghul commented Nov 16, 2012

Please define "text message". It could de anything. text/plain, text/html, text/base64 (not sure if it exists bu anyway). And the best one: message/cpim, which contains a wrapped content type.

JsSIP is a SIP stack, not an IM client.

Yes, we need to pass the iscomposing body to the user. BUT, we can build another API on top of this, which just deals with IM, so it's hidden and only available to those who really want to.

@ibc
Copy link
Member

ibc commented Nov 16, 2012

If defining what a "text message" is is so hard then we have chosen the wrong protocol ;)

Not 100% sure, but IMHO it would make sense some API that calls a function by passing the "body" of the message and some other parameter "type" which could be "text", "html" or "other".

In the case of "iscomposing" we need a separate callback (IMHO).

Is it ok to discuss this subject in a separate issue?

@jmillan
Copy link
Member Author

jmillan commented Nov 16, 2012

In fact it is not an issue but a design task.

@saghul
Copy link
Contributor

saghul commented Nov 16, 2012

Sure, let's discuss it as a design issue. Since it will probably require API changes, I'd go for applying the suggested fix on 0.2 branch and update the docs saying that only text/plain is supported right now.

@jmillan
Copy link
Member Author

jmillan commented Nov 20, 2012

Issue defined in the initial note has been solved 4e70a25

@jmillan jmillan closed this as completed Nov 26, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants